mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
eth: fix the block range assignment for log filter
This commit is contained in:
parent
d927cbb638
commit
a4e535ae9f
1 changed files with 6 additions and 8 deletions
|
|
@ -330,15 +330,13 @@ 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
|
begin = crit.FromBlock.Int64()
|
||||||
)
|
|
||||||
if crit.FromBlock == nil {
|
|
||||||
begin = int64(rpc.LatestBlockNumber)
|
|
||||||
}
|
}
|
||||||
if crit.ToBlock == nil {
|
end := rpc.LatestBlockNumber.Int64()
|
||||||
end = int64(rpc.LatestBlockNumber)
|
if crit.ToBlock != nil {
|
||||||
|
end = crit.ToBlock.Int64()
|
||||||
}
|
}
|
||||||
// Construct the range filter
|
// Construct the range filter
|
||||||
filter = NewRangeFilter(api.backend, begin, end, crit.Addresses, crit.Topics)
|
filter = NewRangeFilter(api.backend, begin, end, crit.Addresses, crit.Topics)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue