Skip to content

Commit

Permalink
Merge pull request #293 from OffchainLabs/trace-by-hash-recent-check
Browse files Browse the repository at this point in the history
Add extra check for recent block in debug tracing by hash
  • Loading branch information
PlasmaPower authored Mar 14, 2024
2 parents e5d8587 + 2db51f4 commit 09ec05c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions eth/tracers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ func (api *API) blockByHash(ctx context.Context, hash common.Hash) (*types.Block
if block == nil {
return nil, fmt.Errorf("block %s not found", hash.Hex())
}
canonical := rawdb.ReadCanonicalHash(api.backend.ChainDb(), block.NumberU64())
if hash != canonical {
return nil, fmt.Errorf("hash %s is not currently canonical", hash.Hex())
}
return block, nil
}

Expand Down

0 comments on commit 09ec05c

Please sign in to comment.