Skip to content

Feature: Add implementation of CalculateNextWorkRequired #1997

@tcharding

Description

@tcharding

We recently made our U256 type private and using it to expose Target and Work. Doing so stopped folks from doing arbitrary math with large numbers, one thing that is no longer possible is calculating the next difficulty target.

Add implementation of CalculateNextWorkRequired (incl. logic from GetNextWorkRequired) from Bitcoin Core (both in bitcoin/src/pow.cpp).

For bonus points:

  • Comment the div/mul by 4 so readers of the code know why that is done.
  • Make it rusty instead of a direct copy of the C++.

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