From 6964ff7aa6fbbc7bb85608b8c420e94b48a3116d Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Tue, 25 Jun 2024 16:48:58 +0800 Subject: [PATCH] internal/ethapi: add comment explaining return of nil instead of error (#25097) --- internal/ethapi/api.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 57617622415f..ebc56b3317e3 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -2223,6 +2223,8 @@ func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context, func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error) { tx, blockHash, blockNumber, index := core.GetTransaction(s.b.ChainDb(), hash) if tx == nil { + // When the transaction doesn't exist, the RPC method should return JSON null + // as per specification. return nil, nil } receipts, err := s.b.GetReceipts(ctx, blockHash)