Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Eth JSON-RPC API: eth_getTransactionByHash should return nil when not found #9932

Merged
merged 1 commit into from
Dec 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions node/impl/full/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,19 +237,22 @@ func (a *EthModule) EthGetTransactionByHash(ctx context.Context, txHash *ethtype
// if not found, try to get it from the mempool
pending, err := a.MpoolAPI.MpoolPending(ctx, types.EmptyTSK)
if err != nil {
return nil, fmt.Errorf("cannot get pending txs from mpool: %v", err)
// inability to fetch mpool pending transactions is an internal node error
// that needs to be reported as-is
return nil, fmt.Errorf("cannot get pending txs from mpool: %s", err)
}

for _, p := range pending {
if p.Cid() == cid {
tx, err := newEthTxFromFilecoinMessage(ctx, p, a.StateAPI)
if err != nil {
return nil, fmt.Errorf("cannot get parse message into tx: %v", err)
return nil, fmt.Errorf("could not convert Filecoin message into tx: %s", err)
}
return &tx, nil
}
}
return nil, fmt.Errorf("cannot find cid %v from the mpool", cid)
// Ethereum clients expect an empty response when the message was not found
return nil, nil
}

func (a *EthModule) EthGetTransactionCount(ctx context.Context, sender ethtypes.EthAddress, blkParam string) (ethtypes.EthUint64, error) {
Expand Down