From 47fba4ddb83bb92c6668cd7cf3b095a329196eac Mon Sep 17 00:00:00 2001 From: blindchaser Date: Wed, 8 Jan 2025 18:44:08 -0500 Subject: [PATCH] fix: eth_subscribe with open ended range --- evmrpc/subscribe.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/evmrpc/subscribe.go b/evmrpc/subscribe.go index 80e242be9..502190810 100644 --- a/evmrpc/subscribe.go +++ b/evmrpc/subscribe.go @@ -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 {