2 minor findings · 3 suggestions
Earlier concerns neither republished nor resolved: 2 suggestions. See the Run archive for their assessments.
Findings
[minor] · Signet solution variants bypass hashMerkleRoot deduplication
Static inspection shows that solution variants on default Signet can crowd genuine tips out of the opt-in tracker despite deduplication; generating each variant still requires Signet proof of work.
Location: src/node/staletiptracker.cpp:40 (head).
Details and suggested fix
With -staletips=headers, a peer can take the current signed block, prepend OP_NOP to its Signet solution's scriptSig, recompute the coinbase txid and header merkle root, and grind a new nNonce without a signing key. SignetTxs::Create strips the solution before constructing the signed message, and the default bare-multisig challenge permits this mutation under the verification flags. Submitting the full variant while it has equal work to the active tip reaches BLOCK_VALID_TRANSACTIONS, so the validated-block gate does not prevent admission. IsVariantOnBranch compares the changed raw root, allowing variants to occupy free slots or replace lower-work entries. Once all ten slots contain such variants, genuine equal-work tips are refused; variants of subsequent signed blocks can evict older entries.
Use the solution-stripped BIP 325 merkle root as the variant identity, with storage or reconstruction that supports pruning and startup seeding. Acceptance and storage of these blocks predate this PR; the new effect concerns tracker admission. No exploitation incident was identified, and the mining cost depends on the configured Signet difficulty.
[minor] · Reindexing skips reconstruction of the stale-tip tracker
With -staletips=headers, -reindex and -reindex-chainstate seed before an active tip exists, so pre-existing stale tips can remain absent until a plain restart or another notification for those tips.
Location: src/net_processing.cpp:2171 (head).
Details and suggested fix
SeedFromBlockIndex runs only in the PeerManager constructor, before the background ImportBlocks call. Both reindex modes skip LoadChainTip, so GetEligibleForkPoint rejects every candidate because the active tip is null. Full reindex replay does not repair this: non-genesis blocks are accepted while only genesis is active, so they exceed the work limit for AcceptedStaleTip. With -reindex-chainstate, stored stale blocks are not reaccepted at all. Final forward activation need not disconnect those stale branches, and BlockConnected does not discover them. Consequently, getchaintips(staletips_only=true) can omit eligible pre-existing tips for the session. Move or repeat seeding after ImportBlocks completes its initial chain activation, and extend the ordinary-restart functional test with a -reindex-chainstate case.
Optional improvements
[suggestion] · Headers that become stale after acceptance escape runtime tracking
With -staletips=headers, an otherwise eligible header accepted before its competing block can remain untracked after that block activates if the header's body never arrives; startup seeding would discover it.
Location: src/validation.cpp:3851 (head).
Details and suggested fix
Suppose the active tip is at height H and header A at H+1 arrives first. MaybeNotifyAcceptedStaleTip skips A because it has more work than the active tip. A competing block B then becomes active at H+1, making A an equal-work, off-chain candidate. None of ActiveTipChange, BlockConnected, or UpdatedBlockTip reconsiders A, and reannouncing its known header produces no notification. The normal downloader can request equal-work blocks, but tracking currently depends on the later ReceivedBlockTransactions notification. A bounded recheck of competing headers when the active tip advances would close this headers-only observability gap. Add a functional test that supplies A's header, activates B, and checks tracking without supplying A's body or restarting.
[suggestion] · TESTNET4 difficulty coverage has no acceptance case
A TESTNET4-specific target that rejects every stale tip would leave staletip_tracker_testnet_min_difficulty passing.
Location: src/test/staletiptracker_tests.cpp:345 (head).
Details and suggested fix
The test exercises testnet4_tips only with the very-low-difficulty 0x207fffff candidate; both limit-adjacent cases use testnet_tips. Repeat the above_limit rejection and below_limit acceptance for testnet4_tips. The fixture assigns one unit of work per block independently of nBits, so the existing below_limit sibling is otherwise eligible and would test the difficulty policy rather than fail the excessive-work guard.
[suggestion] · max_depth filters only after constructing historical orphan sets
The new max_depth option leaves the pre-existing all-history set construction intact, doing ordered-set work under cs_main for off-chain blocks that the response will omit.
Location: src/rpc/blockchain.cpp:1701 (head).
Details and suggested fix
Compute the minimum height once and skip older index entries before inserting into setOrphans and setPrevs. This preserves the output: any child that prevents a retained block from being a tip is one block higher, so that child also passes the cutoff. Omitted older blocks cannot appear in the response anyway. The tracked-tip path can retain its output-loop filter. This avoids allocations and ordering for historical off-chain entries, although the full index scan remains and no speedup was measured.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Tracking integration precedes the tests that can observe it (earlier report)
- [suggestion]: The Signet variant comment misidentifies
nBitsas mutable (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
Stale-tip relay is optional network observability with secondary reorg-preparation benefits, rather than a requirement for consensus operation. The BIP identifies stale rates as evidence of propagation problems, partitions, or adversarial mining, and notes that already downloading a competing equal-work block can accelerate a subsequent reorg. Because these benefits are nonessential, low performance demands and strict resource limits are explicit design goals.
This explains why the new tracker selects a bounded, recent subset rather than trying to provide an exhaustive historical fork archive. It also explains the preference for tips relevant to possible reorgs.
Unresolved disagreements
The inspected discussion leaves a genuine selection tradeoff: prioritizing high-work, recently learned tips favors reorg preparedness, while randomized selection could expose more distinct stale tips across the network. Likewise, mapping testnet4's many branches was raised as useful, but opposed by the ease of manufacturing difficulty-one branches. Exact selection remained local policy rather than a single prescribed optimum.
The pinned bounded, work-ranked tracker and stricter test-network gates choose particular points in these tradeoffs. Historical arguments explain the competing objectives, but do not prove that runtime discovery order, hash-based restart order, or exhaustive branch coverage must take precedence.