fix: Eth JSON-RPC API: eth_getTransactionByHash should return nil when not found.
This commit is contained in:
parent
e7aa7cb04f
commit
bb5cb19607
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user