Skip to content

perf(dash): cheaper Dark Gravity Wave check per header #1431

Open

Description

@ZocoLini

BlockHeaderValidator calls next_work_required for every header (dash-spv/src/validation/header.rs). dark_gravity_wave recomputes U256 arithmetic over a 24-block window each time, and the U256 div_rem from bitcoin-internals is bit-serial. At opt-level 0 this is about 40% of the header phase CPU.

Make the per-header check cheaper, for example by not recomputing the window from scratch or by using a word-based division.

Part of #1425.

Metadata

Metadata

Assignees

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