Skip to content

Commit c278fa8

Browse files
committed
Add total difficulty
1 parent 4e9116d commit c278fa8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

multinode/adaptor.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,14 @@ func (m *Adapter[RPC, HEAD]) OnNewHead(ctx context.Context, requestCh <-chan str
189189
defer m.chainInfoLock.Unlock()
190190
if !CtxIsHeathCheckRequest(ctx) {
191191
m.highestUserObservations.BlockNumber = max(m.highestUserObservations.BlockNumber, head.BlockNumber())
192+
m.highestUserObservations.TotalDifficulty = MaxTotalDifficulty(m.highestUserObservations.TotalDifficulty, head.BlockDifficulty())
192193
}
193194
select {
194195
case <-requestCh: // no need to update latestChainInfo, as rpcMultiNodeAdapter already started new life cycle
195196
return
196197
default:
197198
m.latestChainInfo.BlockNumber = head.BlockNumber()
199+
m.latestChainInfo.TotalDifficulty = head.BlockDifficulty()
198200
}
199201
}
200202

0 commit comments

Comments
 (0)