Skip to content

Commit 816f44b

Browse files
committed
Fix inclusive range calculation for block scanning in BlockchainInterfaceWeb3
Adjusted the end block marker calculation to correctly account for inclusive ranges by subtracting 1 from the scan range. T
1 parent db4e2b1 commit 816f44b

File tree

1 file changed

+3
-1
lines changed
  • node/src/blockchain/blockchain_interface/blockchain_interface_web3

1 file changed

+3
-1
lines changed

node/src/blockchain/blockchain_interface/blockchain_interface_web3/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,9 @@ impl BlockchainInterfaceWeb3 {
367367
) -> BlockMarker {
368368
let locally_determined_end_block_marker = match (start_block_marker, scan_range) {
369369
(BlockMarker::Value(start_block), BlockScanRange::Range(scan_range_number)) => {
370-
BlockMarker::Value(start_block + scan_range_number)
370+
// Subtract 1 because the range is inclusive: [start_block, end_block]
371+
// Example: If max range is 20000, we need start_block to start_block+20000-1 (ending up with 20000 blocks total)
372+
BlockMarker::Value(start_block + scan_range_number - 1)
371373
}
372374
(_, _) => BlockMarker::Uninitialized,
373375
};

0 commit comments

Comments
 (0)