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 /eth/api_backend.go | |
parent | a1984ce727642b1989657b9eb430562d47f89c70 (diff) | |
parent | 5cf1d354704cd2cbc5c64c96d4aaabeeec7dd161 (diff) | |
download | go-tangerine-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.tar go-tangerine-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.tar.gz go-tangerine-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.tar.bz2 go-tangerine-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.tar.lz go-tangerine-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.tar.xz go-tangerine-7f74bdf8dded0e1ac3c01e043c2ed89d78f308cf.tar.zst go-tangerine-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 'eth/api_backend.go')
-rw-r--r-- | eth/api_backend.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/eth/api_backend.go b/eth/api_backend.go index 91f392f94..ecd5488a2 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -104,6 +104,18 @@ func (b *EthApiBackend) GetReceipts(ctx context.Context, blockHash common.Hash) return core.GetBlockReceipts(b.eth.chainDb, blockHash, core.GetBlockNumber(b.eth.chainDb, blockHash)), nil } +func (b *EthApiBackend) GetLogs(ctx context.Context, blockHash common.Hash) ([][]*types.Log, error) { + receipts := core.GetBlockReceipts(b.eth.chainDb, blockHash, core.GetBlockNumber(b.eth.chainDb, blockHash)) + if receipts == nil { + return nil, nil + } + logs := make([][]*types.Log, len(receipts)) + for i, receipt := range receipts { + logs[i] = receipt.Logs + } + return logs, nil +} + func (b *EthApiBackend) GetTd(blockHash common.Hash) *big.Int { return b.eth.blockchain.GetTdByHash(blockHash) } |