Skip to content

bug(bitcoin-da): verifier.rs regtest height fallback underflows when block height is 0 #3260

@amathxbt

Description

@amathxbt

Description

In verifier.rs, the regtest/nightly fallback constructs a default LatestDaState with block_height: block_header.height() - 1. When height() == 0 and no prior state exists this underflows: panic in debug builds, u64::MAX in release.

Expected behaviour

Use saturating_sub(1) to safely produce 0 at genesis.

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