From 7cca2022c16f850c93aa1fe65fffc44796e8aead Mon Sep 17 00:00:00 2001 From: Edward Houston Date: Tue, 7 Apr 2026 14:48:29 +0200 Subject: [PATCH] Fix incorrect block progress calculation in header download log tip_height is 0-indexed, so the total header count is tip_height + 1. Using tip_height as the denominator caused >100% progress (e.g. 200% with 2 blocks) and division by zero when tip_height is 0. Fixes Blockstream/electrs#197 --- src/daemon.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/daemon.rs b/src/daemon.rs index b4e3cfc10..b2f0436b6 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -784,8 +784,8 @@ impl Daemon { info!( "downloaded {}/{} block headers ({:.0}%)", result.len(), - tip_height, - result.len() as f32 / tip_height as f32 * 100.0 + tip_height + 1, + result.len() as f32 / (tip_height + 1) as f32 * 100.0 ); }