Skip to content

Commit

Permalink
Add total difficulty
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanTinianov committed Jan 14, 2025
1 parent 4e9116d commit c278fa8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions multinode/adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,14 @@ func (m *Adapter[RPC, HEAD]) OnNewHead(ctx context.Context, requestCh <-chan str
defer m.chainInfoLock.Unlock()
if !CtxIsHeathCheckRequest(ctx) {
m.highestUserObservations.BlockNumber = max(m.highestUserObservations.BlockNumber, head.BlockNumber())
m.highestUserObservations.TotalDifficulty = MaxTotalDifficulty(m.highestUserObservations.TotalDifficulty, head.BlockDifficulty())
}
select {
case <-requestCh: // no need to update latestChainInfo, as rpcMultiNodeAdapter already started new life cycle
return
default:
m.latestChainInfo.BlockNumber = head.BlockNumber()
m.latestChainInfo.TotalDifficulty = head.BlockDifficulty()
}
}

Expand Down

0 comments on commit c278fa8

Please sign in to comment.