internal: early exit if tx for getTxReceipt not found (#27712)

internal/ethapi: fast exit if tx notfound
This commit is contained in:
Delweng 2023-07-13 18:42:48 +08:00 committed by GitHub
parent 4f0d8f0d15
commit 10a136a4f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1681,7 +1681,7 @@ func (s *TransactionAPI) GetRawTransactionByHash(ctx context.Context, hash commo
// GetTransactionReceipt returns the transaction receipt for the given transaction hash.
func (s *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error) {
tx, blockHash, blockNumber, index, err := s.b.GetTransaction(ctx, hash)
if err != nil {
if tx == nil || err != nil {
// When the transaction doesn't exist, the RPC method should return JSON null
// as per specification.
return nil, nil