Skip to content

Commit

Permalink
Merge pull request #111 from ethpandaops/pk910/fix-cl-forks
Browse files Browse the repository at this point in the history
Workaround for fork grouping in finalized block range
  • Loading branch information
pk910 authored Aug 23, 2024
2 parents 2304064 + a547756 commit 74b1c7c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions services/chainservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,18 @@ type ConsensusClientFork struct {

func (bs *ChainService) GetConsensusClientForks() []*ConsensusClientFork {
headForks := []*ConsensusClientFork{}
chainState := bs.consensusPool.GetChainState()
for _, client := range bs.beaconIndexer.GetAllClients() {
cHeadSlot, cHeadRoot := client.GetClient().GetLastHead()
var matchingFork *ConsensusClientFork
for _, fork := range headForks {

if cHeadSlot < chainState.GetFinalizedSlot() && bytes.Equal(fork.Root[:], cHeadRoot[:]) {
// TODO: find a more elgant way to group forks for finalized blocks
matchingFork = fork
break
}

isInChain, _ := bs.beaconIndexer.GetBlockDistance(cHeadRoot, fork.Root)
if isInChain {
matchingFork = fork
Expand Down

0 comments on commit 74b1c7c

Please sign in to comment.