aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/bind
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2018-02-22 18:48:14 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-02-23 01:12:43 +0800
commit5cf1d354704cd2cbc5c64c96d4aaabeeec7dd161 (patch)
tree10c38cbf3cd5a0e796d6df6c667cc84ce57e2a34 /accounts/abi/bind
parent45352477933d71ec5055504da74547b0cdf0274b (diff)
downloadgo-tangerine-5cf1d354704cd2cbc5c64c96d4aaabeeec7dd161.tar
go-tangerine-5cf1d354704cd2cbc5c64c96d4aaabeeec7dd161.tar.gz
go-tangerine-5cf1d354704cd2cbc5c64c96d4aaabeeec7dd161.tar.bz2
go-tangerine-5cf1d354704cd2cbc5c64c96d4aaabeeec7dd161.tar.lz
go-tangerine-5cf1d354704cd2cbc5c64c96d4aaabeeec7dd161.tar.xz
go-tangerine-5cf1d354704cd2cbc5c64c96d4aaabeeec7dd161.tar.zst
go-tangerine-5cf1d354704cd2cbc5c64c96d4aaabeeec7dd161.zip
eth, les, light: filter on logs only, derive receipts on demand
Diffstat (limited to 'accounts/abi/bind')
-rw-r--r--accounts/abi/bind/backends/simulated.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go
index bd342a8cb..fe7dea4da 100644
--- a/accounts/abi/bind/backends/simulated.go
+++ b/accounts/abi/bind/backends/simulated.go
@@ -428,10 +428,23 @@ func (fb *filterBackend) HeaderByNumber(ctx context.Context, block rpc.BlockNumb
}
return fb.bc.GetHeaderByNumber(uint64(block.Int64())), nil
}
+
func (fb *filterBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) {
return core.GetBlockReceipts(fb.db, hash, core.GetBlockNumber(fb.db, hash)), nil
}
+func (fb *filterBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) {
+ receipts := core.GetBlockReceipts(fb.db, hash, core.GetBlockNumber(fb.db, hash))
+ 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 (fb *filterBackend) SubscribeTxPreEvent(ch chan<- core.TxPreEvent) event.Subscription {
return event.NewSubscription(func(quit <-chan struct{}) error {
<-quit