eth/filters: fix the block range assignment for log filter (#17284)

This commit is contained in:
gary rong 2018-07-31 17:10:38 +08:00 committed by Daniel Liu
parent 43f038dbac
commit 65b48159d1

View file

@ -338,18 +338,12 @@ func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([
filter = NewBlockFilter(api.backend, *crit.BlockHash, crit.Addresses, crit.Topics) filter = NewBlockFilter(api.backend, *crit.BlockHash, crit.Addresses, crit.Topics)
} else { } else {
// Convert the RPC block numbers into internal representations // Convert the RPC block numbers into internal representations
var ( begin := rpc.LatestBlockNumber.Int64()
begin int64 if crit.FromBlock != nil {
end int64
)
if crit.FromBlock == nil {
begin = int64(rpc.LatestBlockNumber)
} else {
begin = crit.FromBlock.Int64() begin = crit.FromBlock.Int64()
} }
if crit.ToBlock == nil { end := rpc.LatestBlockNumber.Int64()
end = int64(rpc.LatestBlockNumber) if crit.ToBlock != nil {
} else {
end = crit.ToBlock.Int64() end = crit.ToBlock.Int64()
} }
// Construct the range filter // Construct the range filter