Skip to content

Logs: Incorrect block progress calculation #197

@RuslanProgrammer

Description

@RuslanProgrammer

electrs/src/daemon.rs

Lines 784 to 789 in 335b567

info!(
"downloaded {}/{} block headers ({:.0}%)",
result.len(),
tip_height,
result.len() as f32 / tip_height as f32 * 100.0
);

When running regtest, I found the following log:
INFO downloaded 2/1 block headers (200%)

Flow example:
The node has 2 blocks:

  • Genesis block at height 0
  • One mined block at height 1

So there are 2 headers in total.

Expected behaviour:
Have a log like:
INFO downloaded 2/2 block headers (100%)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions