Eth API: fail when requesting future epochs.
This commit is contained in:
parent
5df2af5189
commit
a0821506bc
@ -254,6 +254,9 @@ func (a *EthModule) parseBlkParam(ctx context.Context, blkParam string, strict b
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot parse block number: %v", err)
|
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)
|
ts, err := a.Chain.GetTipsetByHeight(ctx, abi.ChainEpoch(num), nil, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot get tipset at height: %v", num)
|
return nil, fmt.Errorf("cannot get tipset at height: %v", num)
|
||||||
|
Loading…
Reference in New Issue
Block a user