Skip to content

Commit

Permalink
cmd/geth: check block range against chain head in export cmd (ethereu…
Browse files Browse the repository at this point in the history
…m#22387)

Check the input parameters against the actual head block, exit on error
  • Loading branch information
s1na authored Mar 22, 2021
1 parent 0c70b83 commit 8d6cc16
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/geth/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ func exportChain(ctx *cli.Context) error {
if first < 0 || last < 0 {
utils.Fatalf("Export error: block number must be greater than 0\n")
}
if head := chain.CurrentFastBlock(); uint64(last) > head.NumberU64() {
utils.Fatalf("Export error: block number %d larger than head block %d\n", uint64(last), head.NumberU64())
}
err = utils.ExportAppendChain(chain, fp, uint64(first), uint64(last))
}

Expand Down

0 comments on commit 8d6cc16

Please sign in to comment.