Skip to content

Commit

Permalink
Eth API: fail when requesting future epochs.
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Mar 8, 2023
1 parent cef416e commit 28d8b4c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions node/impl/full/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ func (a *EthModule) parseBlkParam(ctx context.Context, blkParam string, strict b
if err != nil {
return nil, fmt.Errorf("cannot parse block number: %v", err)
}
if abi.ChainEpoch(num) > head.Height()-1 {
return nil, fmt.Errorf("requested a future epoch (beyond 'latest')")
}
ts, err := a.Chain.GetTipsetByHeight(ctx, abi.ChainEpoch(num), nil, true)
if err != nil {
return nil, fmt.Errorf("cannot get tipset at height: %v", num)
Expand Down

0 comments on commit 28d8b4c

Please sign in to comment.