diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-02-23 17:50:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-23 17:50:16 +0800 |
commit | 7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf (patch) | |
tree | 066d68abcb5cbe1980b0b770b8d135e06b54225d /internal | |
parent | a1984ce727642b1989657b9eb430562d47f89c70 (diff) | |
parent | 5cf1d354704cd2cbc5c64c96d4aaabeeec7dd161 (diff) | |
download | dexon-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.tar dexon-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.tar.gz dexon-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.tar.bz2 dexon-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.tar.lz dexon-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.tar.xz dexon-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.tar.zst dexon-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.zip |
Merge pull request #16164 from karalabe/les-receipt-fix-optimal
eth, les, light: filter on logs only, derive receipts on demand
Diffstat (limited to 'internal')
-rw-r--r-- | internal/ethapi/api.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 636d0bfe2..d021b127c 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1032,15 +1032,19 @@ func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context, } // GetTransactionReceipt returns the transaction receipt for the given transaction hash. -func (s *PublicTransactionPoolAPI) GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error) { +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 { return nil, errors.New("unknown transaction") } - receipt, _, _, _ := core.GetReceipt(s.b.ChainDb(), hash) // Old receipts don't have the lookup data available - if receipt == nil { + receipts, err := s.b.GetReceipts(ctx, blockHash) + if err != nil { + return nil, err + } + if len(receipts) <= int(index) { return nil, errors.New("unknown receipt") } + receipt := receipts[index] var signer types.Signer = types.FrontierSigner{} if tx.Protected() { |