Fix bor tx missing

This commit is contained in:
Jerry 2024-10-09 09:35:49 -07:00
parent 48bdfa7ffb
commit 3b9f73ab69
No known key found for this signature in database
GPG key ID: 5B33FA23CB103211

View file

@ -2006,19 +2006,12 @@ func (api *TransactionAPI) GetTransactionByHash(ctx context.Context, hash common
// Try to return an already finalized transaction // Try to return an already finalized transaction
found, tx, blockHash, blockNumber, index, err := api.b.GetTransaction(ctx, hash) found, tx, blockHash, blockNumber, index, err := api.b.GetTransaction(ctx, hash)
if !found { if err != nil {
// No finalized transaction, try to retrieve it from the pool return nil, err
if tx := api.b.GetPoolTransaction(hash); tx != nil {
return NewRPCPendingTransaction(tx, api.b.CurrentHeader(), api.b.ChainConfig()), nil
}
if err == nil {
return nil, nil
}
return nil, NewTxIndexingError()
} }
// fetch bor block tx if necessary // fetch bor block tx if necessary
if tx == nil { if !found {
if tx, blockHash, blockNumber, index, err = api.b.GetBorBlockTransaction(ctx, hash); err != nil { if tx, blockHash, blockNumber, index, err = api.b.GetBorBlockTransaction(ctx, hash); err != nil {
return nil, err return nil, err
} }