Skip to content

Commit 09ec05c

Browse files
authored
Merge pull request ethereum#293 from OffchainLabs/trace-by-hash-recent-check
Add extra check for recent block in debug tracing by hash
2 parents e5d8587 + 2db51f4 commit 09ec05c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

eth/tracers/api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ func (api *API) blockByHash(ctx context.Context, hash common.Hash) (*types.Block
128128
if block == nil {
129129
return nil, fmt.Errorf("block %s not found", hash.Hex())
130130
}
131+
canonical := rawdb.ReadCanonicalHash(api.backend.ChainDb(), block.NumberU64())
132+
if hash != canonical {
133+
return nil, fmt.Errorf("hash %s is not currently canonical", hash.Hex())
134+
}
131135
return block, nil
132136
}
133137

0 commit comments

Comments
 (0)