Skip to content

Shouldn't Amount handle decimals formatting with {:.8} ? #2136

@RCasatta

Description

@RCasatta

I would expect this to work

        assert_eq!("0.00000010 BTC", format!("{:.8}", Amount::from_sat(10)));

While it fails with:

  left: `"0.00000010 BTC"`,
 right: `"0.0000001 BTC"`', bitcoin/src/amount.rs:2379:9

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-unitsPRs modifying the units cratebug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions