diff options
author | gary rong <garyrong0905@gmail.com> | 2018-07-31 17:10:38 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-07-31 17:10:38 +0800 |
commit | c4a1d4fecf5efcf5095c667b7b311061173799b4 (patch) | |
tree | 1089b441cfe1ed916b8a83d645205d45381078ef /eth | |
parent | fb9f7261ec51e38eedb454594fc19f00de1a6834 (diff) | |
download | dexon-c4a1d4fecf5efcf5095c667b7b311061173799b4.tar dexon-c4a1d4fecf5efcf5095c667b7b311061173799b4.tar.gz dexon-c4a1d4fecf5efcf5095c667b7b311061173799b4.tar.bz2 dexon-c4a1d4fecf5efcf5095c667b7b311061173799b4.tar.lz dexon-c4a1d4fecf5efcf5095c667b7b311061173799b4.tar.xz dexon-c4a1d4fecf5efcf5095c667b7b311061173799b4.tar.zst dexon-c4a1d4fecf5efcf5095c667b7b311061173799b4.zip |
eth/filters: fix the block range assignment for log filter (#17284)
Diffstat (limited to 'eth')
-rw-r--r-- | eth/filters/api.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/eth/filters/api.go b/eth/filters/api.go index 6fea14fee..5ed80a887 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -330,15 +330,13 @@ func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([ filter = NewBlockFilter(api.backend, *crit.BlockHash, crit.Addresses, crit.Topics) } else { // Convert the RPC block numbers into internal representations - var ( - begin int64 - end int64 - ) - if crit.FromBlock == nil { - begin = int64(rpc.LatestBlockNumber) + begin := rpc.LatestBlockNumber.Int64() + if crit.FromBlock != nil { + begin = crit.FromBlock.Int64() } - if crit.ToBlock == nil { - end = int64(rpc.LatestBlockNumber) + end := rpc.LatestBlockNumber.Int64() + if crit.ToBlock != nil { + end = crit.ToBlock.Int64() } // Construct the range filter filter = NewRangeFilter(api.backend, begin, end, crit.Addresses, crit.Topics) |