From ba99e192152733e191ada0cff76369b19dbf5f6f Mon Sep 17 00:00:00 2001 From: Kosuke Taniguchi <73885532+TaniguchiKosuke@users.noreply.github.com> Date: Fri, 17 Jun 2022 00:08:25 +0900 Subject: [PATCH] internal/ethapi: add comment explaining return of nil instead of error (#25097) Co-authored-by: Felix Lange --- internal/ethapi/api.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 4aa37a8dc..24d9b5856 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1581,6 +1581,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, err := s.b.GetTransaction(ctx, hash) if err != 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)