4 minor findings · 8 suggestions
Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.
Findings
[minor] · have_block ignores per-peer block-serving restrictions
A pruned node with -staletips=headers can advertise retained stale blocks 291–1000 blocks below its tip with have_block=true, yet disconnect ordinary requesters; no current automatic Core caller requesting these deep blocks was found.
Location: src/net_processing.cpp:6019 (head).
Details and suggested fix
can_serve_branch checks only BLOCK_HAVE_DATA and BlockRequestAllowed, whose stale-block requirements include script validity and a 30-day age/work bound. A pruned node can retain a reorged-out short branch beyond the 290-block limited-serving window, for example with -prune=1 or a large prune target. ProcessGetBlockData nevertheless disconnects its requester unless it has NoBan. It also disconnects requests for blocks older than HISTORICAL_BLOCK_AGE after -maxuploadtarget is reached unless the peer has Download. The manual getblockfrompeer path reaches FetchBlock without checking these restrictions. The availability bit also reveals retention below the existing prune-height privacy boundary, though its additional fingerprinting value is unclear.
Factor the per-peer serving policy into a side-effect-free predicate shared by this callback and ProcessGetBlockData, preserving both permission exceptions. Set have_block=false when serving would be refused, which also skips the signet announcement, and add a retained pruned-block test.
[minor] · staletip can start downloads whose replies are ignored during import
With -staletips=headers, a recent tip and an overlapping -loadblock import, a higher-work have_block=true announcement can start a download whose reply is discarded, leaving a timeout; no production occurrence was found.
Location: src/net_processing.cpp:6027 (head).
Details and suggested fix
ProcessStaleTip lacks the LoadingBlocks() guard used by the existing header and block handlers. HandleStaleTip can therefore invoke HeadersDirectFetchBlocks during import because CanDirectFetch() checks tip recency, not import state. If the peer replies before import finishes, the BLOCK handler returns before RemoveBlockRequest. The block remains in flight, other direct fetches skip it, and without another delivery or disconnection the download-timeout path eventually disconnects the peer that already answered. Startup permits this overlap because networking need not wait for the background import when an active tip already exists. Add the same LoadingBlocks() early return to ProcessStaleTip and test that an announcement received during a held-open import sends no getdata.
[minor] · Signet headers mode lacks a path from received headers to relay
On signet, -staletips=headers advertises prefers_blocks=1, but an equal- or lower-work announcement whose block is missing cannot become tracked or relayable through this mode alone.
Location: src/net_processing.cpp:6111 (head).
Details and suggested fix
Signet's AddStaleTip requires BLOCK_VALID_TRANSACTIONS, but HandleStaleTip fetches blocks only for strictly higher-work tips with have_block set. Ordinary stale announcements therefore add headers without entering the tracker or getchaintips(staletips_only=true). Independent block acquisition can make them trackable, but transaction-valid data alone still does not satisfy onward relay: signet announcements require have_block, and BlockRequestAllowed requires BLOCK_VALID_SCRIPTS for stale blocks. Provide a bounded acquisition and validation path satisfying both gates, or explicitly scope the current option and release note to independently obtained eligible signet blocks rather than saying that peer announcements are tracked and relayed.
[minor] · FIFO eviction removes punishment protection from in-flight blocks
Twenty unrelated staletip announcements can evict an in-flight block's have_block offer and restore punishment for a connect-time failure; this is uncommon for honest senders, and Core currently offers only script-valid blocks.
Location: src/node/staletiprelayman.cpp:98 (head).
Details and suggested fix
ReceivedStaleTip stores the offer in the same 20-entry deque used for echo suppression. Every new distinct tip can evict an entry, including header-only tips and tips rejected by the tracker. If twenty unrelated announcements arrive before the requested block, IsAnnouncedStaleBranchBlock loses the only record of its offer. The full-block handler records only the peer and full-versus-compact source flag, so a stored block that subsequently fails ConnectBlock with BLOCK_CONSENSUS reaches Misbehaving. Keep the offer exemption with the request's provenance through validation, independently of echo-history eviction, and release it after validation or request abandonment. Add a case that churns the history before delivering the requested block.
Optional improvements
[suggestion] · Stale-tip work admission can be narrower than the height window
Reusing the existing tip-difficulty approximation can reject previously unknown stale tips inside the sender's 1000-block height window after a difficulty decrease; BIP 332 permits this stricter local policy.
Location: src/net_processing.cpp:6060 (head).
Details and suggested fix
GetAntiDoSWorkThreshold(1000) subtracts 1000 * GetBlockProof(*tip), not the cumulative work in the last 1000 heights. Just after a difficulty halving, that subtracts only about 500 old-difficulty blocks of work. A one-block fork around 600 heights back can consequently pass the recency check but fail LOW_WORK, contrary to this call site's compatibility comment. This approximation predates the PR for ordinary headers. For stale-tip admission, derive the threshold from the actual ancestor's chainwork while retaining the MinimumChainWork() floor and leaving ordinary header policy unchanged. If the narrower policy is intentional, document it instead and add a non-uniform-difficulty boundary test.
[suggestion] · Initially higher-work tips are not reconsidered when our chain catches up
A higher-work tip received with have_block=false stays untracked when our active chain catches up, unless another announcement, block-data arrival or restart causes admission to run again.
Location: src/validation.cpp:3851 (head).
Details and suggested fix
MaybeNotifyAcceptedStaleTip excludes headers with more work than the active tip, and ReceivedStaleTip cannot admit them because GetEligibleForkPoint has the same upper-work condition. With have_block=false, no block download supplies another notification. Advancing the active tip does not retry admission, while senders normally announce each tracked tip only once per connection. The existing “already known tip” case demonstrates that a subsequent announcement is needed even after the tip becomes eligible. Recheck a bounded set of pending higher-work announcements on active-tip advance, using the existing network policies; the remembered announcements could supply that set without rescanning the full block index.
[suggestion] · Release note overstates the invalid-block punishment exemption
The release note implies all invalid blocks on announced stale branches avoid disconnection, but the exemption requires a remembered have_block offer and excludes failures before storage.
Location: doc/release-notes-36920.md:8 (head).
Details and suggested fix
IsExemptStaleBranchFailure requires stored block data or BLOCK_CACHED_INVALID, and IsAnnouncedStaleBranchBlock additionally requires a remembered offer with have_block set. The added duplicate-input case explicitly expects disconnection for a CheckBlock failure despite the announcement. Qualify the note to cover blocks that fail only when connected, or arrive after an ancestor was found invalid, while stating that failures in the checks performed before storage remain punishable.
[suggestion] · Signet variant rationale names nBits instead of the nonce
IsVariantOnBranch attributes valid signet variants to changing nBits, although consensus fixes it for a given parent; re-mining the unsigned nonce is the applicable example.
Location: src/node/staletiptracker.cpp:27 (head).
Details and suggested fix
ContextualCheckBlockHeader requires exactly GetNextWorkRequired, and signet disables the minimum-difficulty exception. Changing nBits therefore does not produce another valid variant for the same parent. The signet solution does not commit to nNonce, so anyone can re-mine that field without obtaining another signature. Describe nonce re-mining in this comment and leave the existing previous-block/merkle-root deduplication rule unchanged.
[suggestion] · Outbound negotiation is not checked by test_relay_targeting
The functional tests do not assert that non-negotiating peers receive no staletip, so removing the outbound BIP332 negotiation gate could leave their assertions passing.
Location: test/functional/p2p_staletip.py:594 (head).
Details and suggested fix
All recipients in the targeting table use connect_peer() with its default feature advertisement. The existing plain_peer case checks only block inventory, not its recorded stale-tip messages. Add self.connect_peer(send_feature=False) to this fixture, have it send tip_inv as by_inv does, and include it with receives_a=False and receives_b=False. The existing assert_no_staletip helper then checks the outbound gate without another node or restart. Announcing the active tip ensures that an unknown fork point cannot hide a negotiation regression.
[suggestion] · The higher-work test does not check the peer's header state
Waiting for getdata does not test the UpdatePeerStateForReceivedHeaders call, because direct fetch works from the supplied header without pindexBestKnownBlock.
Location: test/functional/p2p_staletip.py:457 (head).
Details and suggested fix
HandleStaleTip separately updates peer availability before invoking direct fetch. That update supplies pindexBestKnownBlock, which drives parallel download and outbound protection, but removing it would not prevent this test's direct request. Before disconnecting block_peer, assert that its getpeerinfo entry's synced_headers equals getblockheader(block.hash_hex)["height"]. For this fresh peer, which has announced nothing else, the value remains -1 without the update.
[suggestion] · The process_messages fuzzer leaves stale-tip handling disabled
The process_messages harness uses the default StaleTipRelayMode::NONE, so fuzzed staletip messages cannot reach tracking, relay policy or the new punishment exemption.
Location: src/test/fuzz/staletip_message.cpp:12 (head).
Details and suggested fix
Its PeerManager::Options enables reconciliation but never sets stale_tip_relay_mode. Consequently, NegotiatedStaleTip always returns empty. Set .stale_tip_relay_mode = StaleTipRelayMode::HEADERS, or select it from fuzz input. FillNode can leave a compatible peer after VERSION but before VERACK, allowing subsequent fuzzed BIP332 feature negotiation, VERACK and staletip messages to enter the new paths. The separate staletip_message target only covers deserialization, decompression and round-tripping.
[suggestion] · The fetch commit precedes its matching punishment policy
The series introduces staletip block fetching two intervening commits before its punishment exemption, separating the download path from the policy needed to review it; the final tree already has the exemption.
Location: src/net_processing.cpp:6061 at 76bccd409a12 (commit) (commit).
Details and suggested fix
76bccd409a1253c6580bf2e8eeddef962c1b7a6b adds higher-work HandleStaleTip downloads while its BlockChecked still applies ordinary full-block punishment. The exemption and invalid-stale-branch tests arrive in fd7e0be657151f2880b137993b3db81f816587f7, after 6523c3fa72a9773c67b4dc5ffb91246229728a03 (active-tip announcements) and 260c146ddc7c2e78368b8b47a18d4ea106c65187 (outbound relay and per-peer history). BIP 332 senders may serve unconnected blocks, although Core senders currently offer only script-valid blocks, so reviewing the fetch commit requires reading ahead to its matching policy.
Extract the per-peer announced-tip history, declarations and connect/disconnect lifecycle from the relay commit into or just before the fetch commit. Then place the exemption commit immediately after it, or combine them, keeping the higher-work fetch and invalid-stale-branch tests adjacent. Leave outbound announcements and echo suppression later. The policy can remain a separate commit without separating it from the behavior it supports.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: A peer's
prefers_blocksnever affects announcements (earlier report)
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
The 1,000-block window is deliberately approximate rather than a consensus-derived security constant. Towns described it as a round number influenced by the interval between mainnet stale blocks, so new participants would encounter useful data reasonably quickly. Subsequent discussion favored roughly seven days to improve propagation while adoption is low, including through changing extra block-relay-only connections.
This explains why the stale-tip window is much wider than ordinary near-tip header admission. Its purpose is to let interested nodes discover recent observations despite sparse connectivity, rather than to imply that 1,000 confirmations have a special protocol meaning.
Source 1 · Source 2 · Source 3 · Source 4 · Source 5
BIP 434's distinct, versionable feature identifiers justified strict feature-data parsing instead of leaving ambiguous extension slack. During BIP 332 review, the author accepted exactly one byte with value zero or one because future incompatible changes could use versioned feature IDs. The inspected BIP defines prefers_blocks as a collection preference, not proof that every announced branch has been fully validated.
The pinned implementation negotiates BIP332 and ignores malformed feature data. Keeping negotiation separate from block availability and validation is important: support for the message, preference for block-backed announcements, and have_block are different assertions.
Source 1 · Source 2 · Source 3 · Source 4
Unresolved disagreements
The inspected discussion leaves a genuine relay-set tradeoff local: highest-work selection favors reorg readiness, while randomized selection could distribute a greater diversity of stale tips across the network. It does not establish one universally optimal policy.
The pinned ten-tip tracker chooses the reorg-readiness objective. Its bounded relay set therefore should not be interpreted as guaranteeing exhaustive dissemination of all observed stale branches.