Skip to content

Commit 5852c0c

Browse files
EddieHoustonphilippem
authored andcommitted
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 #197
1 parent dfcb4fe commit 5852c0c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/daemon.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,8 @@ impl Daemon {
784784
info!(
785785
"downloaded {}/{} block headers ({:.0}%)",
786786
result.len(),
787-
tip_height,
788-
result.len() as f32 / tip_height as f32 * 100.0
787+
tip_height + 1,
788+
result.len() as f32 / (tip_height + 1) as f32 * 100.0
789789
);
790790
}
791791

0 commit comments

Comments
 (0)