From 05f4407c5a7a51898ccc6aeaff1bc2906e741dba Mon Sep 17 00:00:00 2001 From: Franco Barpp Gomes Date: Wed, 29 May 2024 12:47:05 -0300 Subject: [PATCH] fix: Fix non-exact block chunking --- core/safeclient/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/safeclient/client.go b/core/safeclient/client.go index accd1e06..8b878db4 100644 --- a/core/safeclient/client.go +++ b/core/safeclient/client.go @@ -202,8 +202,8 @@ func (c *SafeEthClient) SubscribeFilterLogs(ctx context.Context, q ethereum.Filt fromBlock := max(lastBlock, rangeStartBlock+1) - for ; fromBlock < currentBlock; fromBlock += (c.blockChunkSize + 1) { - toBlock := min(fromBlock+c.blockChunkSize, currentBlock) + for ; fromBlock <= currentBlock; fromBlock += c.blockChunkSize { + toBlock := min(fromBlock+c.blockChunkSize-1, currentBlock) c.logger.Debug("Getting past logs", "fromBlock", fromBlock, "toBlock", toBlock)