From 65b48159d1ae92ae2dd1eee2767971996c6ff60f Mon Sep 17 00:00:00 2001 From: gary rong Date: Tue, 31 Jul 2018 17:10:38 +0800 Subject: [PATCH] eth/filters: fix the block range assignment for log filter (#17284) --- eth/filters/api.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/eth/filters/api.go b/eth/filters/api.go index d7c053c44d..ed36c3a647 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -338,18 +338,12 @@ 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) - } else { + begin := rpc.LatestBlockNumber.Int64() + if crit.FromBlock != nil { begin = crit.FromBlock.Int64() } - if crit.ToBlock == nil { - end = int64(rpc.LatestBlockNumber) - } else { + end := rpc.LatestBlockNumber.Int64() + if crit.ToBlock != nil { end = crit.ToBlock.Int64() } // Construct the range filter