Skip to content

Target::MAX should not consider floating point rounding occuring during compact conversion #1839

@sanket1729

Description

@sanket1729

from bitcoin core

        consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");

We store this as (considering the floating point truncation)

0x00000000FFFF0000000000000000000000000000000000000000000000000000 

because the above value is not representable by compact target. While the result for both operations is the same and would result in the same block acceptance, I believe the former matches the core semantics better.

I believe this should also be considered a bug as it changes the output of difficulty function. Ideally, we should be able to cross check this operation with other exploerers/implementations.

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