Merge pull request #10474 from filecoin-project/raulk/fix-pending-support

fix: revert "Eth API: drop support for 'pending' block parameter."
This commit is contained in:
Łukasz Magiera 2023-03-16 08:49:49 +01:00 committed by GitHub
commit c0aed3c4a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -236,13 +236,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 {