Skip to content

Review finding: low-work headers sync cannot pass an AuxPoW-dense range and restarts at every announcement #309

Open

Description

@kiwidream

Summary

Low-work headers sync through an AuxPoW-dense range never completes, and re-downloads the chain at every block announcement from every peer.

Severity: medium. Found in the 2026-11-04 review of the v1.0.1 change set (all 1.x.x merges since v1.0.0 plus the open PRs that target it), against 1.x.x 21fee6ee8e; area: #266.

Observed

Confidence: confirmed (reproduced on the 1.x.x build).

  • Location: src/headerssync.cpp:32-34 (MAX_REDOWNLOAD_AUXPOW_SERIALIZED_SIZE = 9 × 4 MB) and :359-361 (abort), plus src/net_processing.cpp:2746-2822 and :2705-2722 (restart path), at 21fee6e.
  • Scenario:
    1. A node uses low-work sync. Today that means -minimumchainwork above the range, or a fork more than 144 blocks deep; in future, any release that sets nMinimumChainWork > 0.
    2. It syncs through a range where the 15,009 buffered headers plus the current message carry more than 36 MB of AuxPoW payload. That takes about 19 AuxPoW blocks at about 1.9 MB, or 26 at 1.4 MB, within about 15,000 blocks (about 10.4 days, roughly 1% of AuxPoW-lane blocks).
    3. net: bound the size of headers messages we send #266 lets PRESYNC and REDOWNLOAD continue through size-cut messages, so the node now always reaches REDOWNLOAD. There it aborts at the same height every time, before releasing any header.
    4. Nothing is released, so m_best_header does not move. The next block announcement triggers getheaders from the same place, which starts a new full PRESYNC and REDOWNLOAD cycle. This repeats with every non-noban peer, indefinitely.
    • Reproduced (local functional test, not in the repository; v1.0.1 node with -minimumchainwork at the tip; 26 × 1.4 MB AuxPoW blocks):
      • The abort retained auxpow serialized size exceeded limit at height=36 (redownload phase) repeated on all 4 cycles, each restarting at height 0.
      • The node stayed at headers=0 blocks=0, still connected.
      • It received 302,470,362 bytes in 108 headers messages, about 75 MB per announcement, from one peer.
      • A default-settings v1.0.1 node synced the same chain in 0.2 s.
      • The abort is logged only under -debug=net. The info log keeps showing "Pre-synchronizing blockheaders" climbing to 100% and then restarting.
  • Evidence: code trace (ValidateAndStoreRedownloadedHeader returns false, then Finalize, then HandleUnconnectingHeaders, whose MaybeSendGetHeaders is rate-limited for 30 s, then the next inv triggers getheaders(m_best_header), then TryLowWorkHeadersSync starts a new HeadersSyncState), plus the functional run above (pass, 4/4 cycles aborted).

Impact

  • Release integrity: release: prepare v1.0.1 #181's known-limitations bullet says low-work sync "gives up on a peer". In fact sync is permanently blocked on all peers, with a recurring bandwidth and CPU cycle. On mainnet, with about 48 MB of headers below a current minimum-work point and 8–10 peers, that is several hundred MB per minute until the operator intervenes.
  • Today's chains are far from the bound (worst window 3.81 MB on mainnet, 4.66 MB on testnet4), and the default nMinimumChainWork is 0. So v1.0.1 defaults are not affected now.
  • It becomes a full-IBD blocker the first time a qbit release sets nMinimumChainWork. Bitcoin Core does that every release; qbit's release-process.md has no such step yet.
  • Not a regression: v1.0.0 cannot sync such a range at all, because its presync hits an oversized message and disconnects.

Suggested fix

  • (a) Reword the release: prepare v1.0.1 #181 bullet: "low-work headers sync cannot complete, from any peer, through a range holding more than about 36 MB of AuxPoW payload within 15,009 headers; it retries at each block announcement".
  • (b) Before any release sets nMinimumChainWork > 0, or docs recommend -minimumchainwork, either activate an AuxPoW payload size cap (soft fork) or re-derive the redownload memory bound in bytes. Two options for the bound: keep only a hash of each buffered header's AuxPoW and re-request it, or allow a larger byte budget for fewer concurrent low-work syncs.
  • (c) Cheap mitigation now: after a retained-size abort, remember (chain start, abort height) per peer and back off instead of restarting presync at every announcement. Log the abort at info level.
  • (d) Add this scenario as a functional test.

Related: extends #181's known limitation "Low-work headers sync still gives up on a peer if the AuxPoW payloads … exceed its existing 36 MB per-peer bound", and #174's open note on MAX_REDOWNLOAD_AUXPOW_SERIALIZED_SIZE. New: - it fails on every peer and never makes progress;

  • each announcement re-downloads the whole range;
  • the abort is not visible at info level;
  • concrete trigger cost and today's margins;
  • the interaction with a future nMinimumChainWork.

Activity

  1. added
    bug
    on Nov 4, 2026
  2. kiwidream commented on Nov 11, 2026

    @kiwidream
    MemberAuthor

    Release-planning note (2026-11-11).

    This blocks a non-zero mainnet nMinimumChainWork.

    • With nMinimumChainWork > 0, every new node runs low-work headers sync from genesis up to that much work. An AuxPoW-dense range below the chosen block would then hit the abort-and-restart loop described above, and new nodes could not sync.
    • v1.0.1 therefore keeps mainnet nMinimumChainWork (and defaultAssumeValid) at zero, as ChainParams_MAIN_launch_bootstrap in src/test/pow_tests.cpp asserts.
    • A non-zero value should ship only in a release that includes the fix for this issue. Under doc/release/release-process.md, it is an x.y.0 decision.

    Current mainnet margin. On 2026-11-10 we did a read-only scan of mainnet block files:

    • 164,128 blocks, tip 164,127, one linear chain.
    • 33,028 AuxPoW headers, 35.0 MB of AuxPoW in total. The largest single payload is 1,165 bytes.

    The worst windows, against the 36,000,000-byte redownload cap:

    Window AuxPoW bytes Margin
    15,009 headers 3.39 MB
    17,009 headers 3.81 MB about 9.5× below the cap
    19,009 headers 4.24 MB about 8.5× below the cap

    Today's history is well under the cap, so a node that sets -minimumchainwork itself still syncs. The abort is still possible in three cases:

    • forks deeper than 144 blocks;
    • a range that later becomes dense, once a future minimum covers it;
    • nodes whose -minimumchainwork covers such a range.

    Before any release raises nMinimumChainWork:

    1. Confirm this issue is fixed.
    2. Re-run the window scan up to the chosen block.
    3. Pick a block about 1–2 weeks behind the tip at release cut, and verify its chainwork on at least two independent synced nodes.
    4. Update ChainParams_MAIN_launch_bootstrap, and say so in the release notes.
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions