net: unify send pause state #36736

pull l0rinc wants to merge 3 commits into bitcoin:master from l0rinc:l0rinc/paused-send-state-cleanup changing 13 files +58 −39
  1. l0rinc commented at 10:12 PM on November 2, 2026: contributor

    Problem: Each peer's send pause state is a flag plus a separate start timestamp. Message queueing and socket sends each duplicate the transition logic that keeps the two in sync, and the inactivity check (which needs both), reads them separately.

    Fix: Move the pause transitions into CNode accessors over one atomic timestamp. The inactivity check then reads the pause status and start time as one snapshot.

    Follow-up to #36667.

  2. test: move pause resets into ProcessMessagesOnce
    The test send buffer limit is zero, so queued messages set `fPauseSend`.
    Move the repeated resets into `ProcessMessagesOnce()`.
    This adds resets at four call sites in `orphan_reconsideration_interruptible`, where the peer is already unpaused.
    Keeping resets here will hide the later unpaused timestamp sentinel from test callers.
    d691fc3f07
  3. refactor: encapsulate pause-send state
    Hide the flag and timestamp behind `CNode` accessors and extract their shared updates into `SetPauseSend()`.
    Both production update sites already hold `cs_vSend`.
    Cover preserving an active pause's start time and recording a fresh one after resuming.
    bd988b3dbc
  4. refactor: unify paused-send state
    Encode the paused state in the timestamp, using epoch for unpaused.
    This removes the separate flag and gives readers one atomic snapshot.
    Preserve the original start time across repeated pause updates.
    f5feda7495
  5. DrahtBot renamed this:
    net: unify send pause state
    net: unify send pause state
    on Nov 2, 2026
  6. DrahtBot added the label P2P on Nov 2, 2026
  7. DrahtBot commented at 10:12 PM on November 2, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36819 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36819.svg"></sub> ([RFC] enable clang-tidy optin.performance.Padding by fanquake)
    • #35558 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35558.svg"></sub> (p2p: Prefill compact blocks by davidgumberg)
    • #35027 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35027.svg"></sub> (net: add -outboundbind option for outgoing source address by 8144225309)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-11-15 02:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me