Skip to content

Commit

Permalink
eth/filters: fix the block range assignment for log filter (#17284)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 authored and karalabe committed Jul 31, 2018
1 parent fb9f726 commit c4a1d4f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions eth/filters/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c4a1d4f

Please sign in to comment.