Skip to content

check_flags mining branch tests a bit range instead of a single bit #2362

Description

@bit-aloo

SetupConnection::check_flags for Protocol::MiningProtocol extracts the work-selection and version-rolling requirements as reversed >> 30 > 0 and reversed >> 29 > 0. After reverse_bits, those are true when any of the higher bits is set, so REQUIRES_STANDARD_JOB (bit 0) also reads as work selection and version rolling, and work selection also reads as version rolling. A downstream that advertises only standard jobs passes an upstream's work-selection or version-rolling gate.

The JobDeclaration branch of the same function uses the correct (reversed >> 31) & 1 form, and has_work_selection / has_version_rolling in the same file are correct. No in-tree role calls check_flags today, but it is public API.

Fix: drop reverse_bits and test flags & REQUIRES_WORK_SELECTION != 0 etc. directly, as the TODO in the JobDeclaration branch already suggests. Related: #2075 asks for a redesigned API.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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