diff options
author | Ryan Schneider <ryanleeschneider@gmail.com> | 2018-09-30 04:53:31 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2018-09-30 04:53:31 +0800 |
commit | b69942befeb9f1af55cad0f91953bdaea2ea3efb (patch) | |
tree | 0a2e4253e4ab715ae42f272009446cb1a75ba9e9 /eth | |
parent | 86ec213076ac52a7b427a0fb25994bfb4e78720b (diff) | |
download | go-tangerine-b69942befeb9f1af55cad0f91953bdaea2ea3efb.tar go-tangerine-b69942befeb9f1af55cad0f91953bdaea2ea3efb.tar.gz go-tangerine-b69942befeb9f1af55cad0f91953bdaea2ea3efb.tar.bz2 go-tangerine-b69942befeb9f1af55cad0f91953bdaea2ea3efb.tar.lz go-tangerine-b69942befeb9f1af55cad0f91953bdaea2ea3efb.tar.xz go-tangerine-b69942befeb9f1af55cad0f91953bdaea2ea3efb.tar.zst go-tangerine-b69942befeb9f1af55cad0f91953bdaea2ea3efb.zip |
core, internal/ethapi: add and use LRU cache for receipts (#17610)
Diffstat (limited to 'eth')
-rw-r--r-- | eth/api_backend.go | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/eth/api_backend.go b/eth/api_backend.go index 03f6012d7..8748d444f 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -25,7 +25,6 @@ import ( "github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/bloombits" - "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" @@ -107,18 +106,11 @@ func (b *EthAPIBackend) GetBlock(ctx context.Context, hash common.Hash) (*types. } func (b *EthAPIBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) { - if number := rawdb.ReadHeaderNumber(b.eth.chainDb, hash); number != nil { - return rawdb.ReadReceipts(b.eth.chainDb, hash, *number), nil - } - return nil, nil + return b.eth.blockchain.GetReceiptsByHash(hash), nil } func (b *EthAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) { - number := rawdb.ReadHeaderNumber(b.eth.chainDb, hash) - if number == nil { - return nil, nil - } - receipts := rawdb.ReadReceipts(b.eth.chainDb, hash, *number) + receipts := b.eth.blockchain.GetReceiptsByHash(hash) if receipts == nil { return nil, nil } |