Skip to content

Commit

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

// convert "fromBlock":"0x0","toBlock":"latest" to default subscription behavior
// by clearing both fromBlock and toBlock
if filter.FromBlock != nil && filter.FromBlock.Int64() == 0 &&
filter.ToBlock != nil && filter.ToBlock.Int64() < 0 {
filter.FromBlock = nil
filter.ToBlock = nil
}

rpcSub := notifier.CreateSubscription()

if filter.BlockHash != nil {
Expand Down

0 comments on commit 47fba4d

Please sign in to comment.