Skip to content

Commit

Permalink
use v2 api to get block bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Aug 17, 2023
1 parent ff7d5e5 commit 57ba3c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ func (indexer *Indexer) runIndexerLoop() error {
logger.Errorf("Indexer Error while polling latest head: %v", err)
}
case <-time.After(30 * time.Second):
logger.Info("No head event since 30 secs, polling chain head")
err := indexer.pollHeadBlock()
if err != nil {
logger.Errorf("Indexer Error while polling latest head: %v", err)
Expand Down
5 changes: 4 additions & 1 deletion rpc/beaconapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ func (bc *BeaconClient) GetBlockHeaderBySlot(slot uint64) (*rpctypes.StandardV1B
}

func (bc *BeaconClient) GetBlockBodyByBlockroot(blockroot []byte) (*rpctypes.StandardV2BeaconBlockResponse, error) {
resp, err := bc.get(fmt.Sprintf("%s/eth/v1/beacon/blocks/0x%x", bc.endpoint, blockroot))
resp, err := bc.get(fmt.Sprintf("%s/eth/v2/beacon/blocks/0x%x", bc.endpoint, blockroot))
if err != nil {
resp, err = bc.get(fmt.Sprintf("%s/eth/v1/beacon/blocks/0x%x", bc.endpoint, blockroot))
}
if err != nil {
return nil, fmt.Errorf("error retrieving block body for 0x%x: %v", blockroot, err)
}
Expand Down

0 comments on commit 57ba3c6

Please sign in to comment.