Revert "Eth API: drop support for 'pending' block parameter."

This reverts commit 9412753ba3.
This commit is contained in:
raulk 2023-03-14 12:49:40 +00:00
parent 27e3c0b89f
commit e8325f9a98

View File

@ -235,13 +235,14 @@ func (a *EthModule) EthGetBlockByHash(ctx context.Context, blkHash ethtypes.EthH
} }
func (a *EthModule) parseBlkParam(ctx context.Context, blkParam string, strict bool) (tipset *types.TipSet, err error) { func (a *EthModule) parseBlkParam(ctx context.Context, blkParam string, strict bool) (tipset *types.TipSet, err error) {
switch blkParam { if blkParam == "earliest" {
case "earliest", "pending": return nil, fmt.Errorf("block param \"earliest\" is not supported")
return nil, fmt.Errorf("block param %q is not supported", blkParam)
} }
head := a.Chain.GetHeaviestTipSet() head := a.Chain.GetHeaviestTipSet()
switch blkParam { switch blkParam {
case "pending":
return head, nil
case "latest": case "latest":
parent, err := a.Chain.GetTipSetFromKey(ctx, head.Parents()) parent, err := a.Chain.GetTipSetFromKey(ctx, head.Parents())
if err != nil { if err != nil {