Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
blindchaser committed Jan 9, 2025
1 parent 47fba4d commit c5603bd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions evmrpc/subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,16 @@ func (a *SubscriptionAPI) Logs(ctx context.Context, filter *filters.FilterCriter
filter = &filters.FilterCriteria{}
}

// convert "fromBlock":"0x0","toBlock":"latest" to default subscription behavior
// by clearing both fromBlock and toBlock
// when fromBlock is 0 and toBlock is latest, treat it as
// no fromBlock and toBlock specified
if filter.FromBlock != nil && filter.FromBlock.Int64() == 0 &&
filter.ToBlock != nil && filter.ToBlock.Int64() < 0 {
filter.FromBlock = nil
filter.ToBlock = nil
unboundedFilter := &filters.FilterCriteria{
BlockHash: nil,
Addresses: filter.Addresses,
Topics: filter.Topics,
}
filter = unboundedFilter
}

rpcSub := notifier.CreateSubscription()
Expand Down

0 comments on commit c5603bd

Please sign in to comment.