Skip to content

Commit c4a1d4f

Browse files
rjl493456442karalabe
authored andcommitted
eth/filters: fix the block range assignment for log filter (#17284)
1 parent fb9f726 commit c4a1d4f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

eth/filters/api.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,13 @@ func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([
330330
filter = NewBlockFilter(api.backend, *crit.BlockHash, crit.Addresses, crit.Topics)
331331
} else {
332332
// Convert the RPC block numbers into internal representations
333-
var (
334-
begin int64
335-
end int64
336-
)
337-
if crit.FromBlock == nil {
338-
begin = int64(rpc.LatestBlockNumber)
333+
begin := rpc.LatestBlockNumber.Int64()
334+
if crit.FromBlock != nil {
335+
begin = crit.FromBlock.Int64()
339336
}
340-
if crit.ToBlock == nil {
341-
end = int64(rpc.LatestBlockNumber)
337+
end := rpc.LatestBlockNumber.Int64()
338+
if crit.ToBlock != nil {
339+
end = crit.ToBlock.Int64()
342340
}
343341
// Construct the range filter
344342
filter = NewRangeFilter(api.backend, begin, end, crit.Addresses, crit.Topics)

0 commit comments

Comments
 (0)