Skip to content

Make near-tip anti-DoS work thresholds lane-independent #78

Closed

Description

@kiwidream

Summary

PeerManagerImpl::GetAntiDoSWorkThreshold() currently derives its 144-block near-tip allowance from:

144 * GetBlockProof(*tip)

Qbit's permissionless and AuxPoW lanes can contribute materially different per-block proof. As a result, the P2P admission threshold changes depending on the active tip's lane rather than the chain's actual recent aggregate work.

This is a bounded P2P DoS/liveness risk, not a known consensus-split risk.

Affected paths

  • src/net_processing.cpp: GetAntiDoSWorkThreshold()
  • Low-work headers synchronization
  • Compact-block admission
  • Block-message min_pow_checked handling
  • src/validation.cpp: the related 6 * GetBlockProof(*tip) best-invalid warning margin

Proposed change

Replace the single-tip proof proxy with the actual chainwork accumulated over the recent window:

  • For chains at least 144 blocks deep, use the chainwork delta between the tip and its 144-block ancestor.
  • For shorter chains, use the available chainwork so the near-tip threshold retains its current conservative behavior.
  • Continue applying MinimumChainWork() as the lower bound.
  • Apply the same lane-independent approach—or record an explicit bounded-risk rationale—to the six-block best-invalid warning margin.

Implementation details should avoid duplicating the recent-chainwork calculation between networking and validation.

Acceptance criteria

  • The 144-block threshold is based on aggregate recent chainwork, not the current tip's proof.
  • Changing only the tip-lane arrangement does not materially collapse or expand the work window when aggregate recent work is unchanged.
  • Short-chain and MinimumChainWork() behavior is covered.
  • Regression coverage addresses:
    • low-work headers synchronization;
    • compact-block admission;
    • block-message min_pow_checked handling.
  • The best-invalid warning margin receives either the same fix or a documented accepted-risk disposition.

Suggested validation

  • Add focused unit tests using synthetic mixed-lane CBlockIndex chains.
  • Run:
    • headers_sync_chainwork_tests
    • denialofservice_tests, if affected
    • p2p_headers_sync_with_minchainwork.py
    • p2p_initial_headers_sync.py
    • feature_minchainwork.py

Activity

  1. added
    bug
    on Jul 10, 2026
  2. changed the title [-][P0][R13] Make near-tip anti-DoS work thresholds lane-independent[/-] [+]Make near-tip anti-DoS work thresholds lane-independent[/+] on Jul 10, 2026
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