Skip to content

Commit 31e95df

Browse files
[BCFR-1441] Subtract 2 from configured rpcBatchSize to account for ref blocks (#49)
* Subtract 2 from configured rpcBatchSize to account for ref blocks * Avoid allowing less than 1 block request per batch
1 parent ee990ae commit 31e95df

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

pkg/logpoller/log_poller.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,12 @@ func (lp *logPoller) fillRemainingBlocksFromRPC(
14201420
"remainingBlocks", remainingBlocks)
14211421
}
14221422

1423-
return lp.batchFetchBlocks(ctx, remainingBlocks, lp.rpcBatchSize)
1423+
batchSize := lp.rpcBatchSize - 2 // subtract 2 to leave room for 2 reference requests added in lp.fetchBlocks()
1424+
if batchSize < 1 {
1425+
batchSize = 1
1426+
}
1427+
1428+
return lp.batchFetchBlocks(ctx, remainingBlocks, batchSize)
14241429
}
14251430

14261431
// newBlockReq constructs an eth_getBlockByNumber request for particular block number

0 commit comments

Comments
 (0)