Skip to content

Commit c31611f

Browse files
author
Ludo Galabru
committed
fix: off by one
1 parent 0e3faf9 commit c31611f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

components/hord-cli/src/cli/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ pub async fn check_bitcoind_connection(config: &Config) -> Result<u64, String> {
798798
};
799799

800800
let end_block = match bitcoin_rpc.get_blockchain_info() {
801-
Ok(result) => result.blocks.saturating_sub(1),
801+
Ok(result) => result.blocks,
802802
Err(e) => {
803803
return Err(format!("unable to connect to bitcoind: {}", e.to_string()));
804804
}

components/hord-cli/src/scan/bitcoin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
6060
let (end_block, update_end_block) = match predicate_spec.end_block {
6161
Some(end_block) => (end_block, false),
6262
None => match bitcoin_rpc.get_blockchain_info() {
63-
Ok(result) => (result.blocks - 1, true),
63+
Ok(result) => (result.blocks, true),
6464
Err(e) => {
6565
return Err(format!(
6666
"unable to retrieve Bitcoin chain tip ({})",
@@ -177,7 +177,7 @@ pub async fn scan_bitcoin_chainstate_via_rpc_using_predicate(
177177
if block_heights_to_scan.is_empty() && floating_end_block {
178178
match bitcoin_rpc.get_blockchain_info() {
179179
Ok(result) => {
180-
for entry in (current_block_height + 1)..result.blocks {
180+
for entry in (current_block_height + 1)..=result.blocks {
181181
block_heights_to_scan.push_back(entry);
182182
}
183183
}

0 commit comments

Comments
 (0)