Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into feat-blob-datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha committed Apr 9, 2024
2 parents 4c9850c + 3cae4ea commit 64ac1f1
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions driver/chain_syncer/beaconsync/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,22 @@ func (s *Syncer) getVerifiedBlockPayload(ctx context.Context, blockID uint64) (*
return nil, err
}

blockInfo, err := s.rpc.GetL2BlockInfo(ctx, new(big.Int).SetUint64(blockID))
if err != nil {
return nil, err
}
ts, err := s.rpc.GetTransition(ctx, new(big.Int).SetUint64(blockInfo.BlockId), blockInfo.VerifiedTransitionId)
if err != nil {
return nil, err
}

if s.syncMode == downloader.FullSync.String() && header.Hash() != ts.BlockHash {
return nil, fmt.Errorf(
"latest verified block hash mismatch: %s != %s",
header.Hash(),
common.BytesToHash(ts.BlockHash[:]),
)
if s.syncMode == downloader.FullSync.String() {
blockInfo, err := s.rpc.GetL2BlockInfo(ctx, new(big.Int).SetUint64(blockID))
if err != nil {
return nil, err
}
ts, err := s.rpc.GetTransition(ctx, new(big.Int).SetUint64(blockInfo.BlockId), blockInfo.VerifiedTransitionId)
if err != nil {
return nil, err
}
if header.Hash() != ts.BlockHash {
return nil, fmt.Errorf(
"latest verified block hash mismatch: %s != %s",
header.Hash(),
common.BytesToHash(ts.BlockHash[:]),
)
}
}

log.Info("Latest verified block header retrieved", "hash", header.Hash())
Expand Down

0 comments on commit 64ac1f1

Please sign in to comment.