Skip to content

p2p: do not park spent confirmed txs as orphans - #558

Merged
reardencode merged 4 commits into
masterfrom
net/orphan-spent-alreadyhave
Sep 15, 2026
Merged

reardencode merged 4 commits into
masterfrom
net/orphan-spent-alreadyhave

Conversation

@rearden-grok

@rearden-grok rearden-grok Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Mainnet txrelay: park floods were mostly txs whose parents were already confirmed (or the confirmed bodies themselves), not true child-before-parent. INV AlreadyHave only looked at the live mempool and orphanage, so peers re-GETDATA'd what we had just stripped.

  • Spent or missing-vout prevouts on a confirmed create are MissingPrevout, not an orphan park (QueryUtxoProvider::chain_prevout). Spentness lookup failure on a confirmed create fails closed (KnownUnavailable).
  • INV AlreadyHave is live mempool + orphanage + a recent-confirmed txid/wtxid ring (filled at tip connect and IBD write, cleared on reorg) + Class A tx_fk_by_txid_tip.
  • Re-delivery of an already-parked orphan still GETDATAs missing parents (TTL) but does not log a second txrelay: park.

Does not change tip-follow peer count, INV trickle, or mempool admission policy.

Test plan

  • spent_confirmed_prevout_is_missing_not_orphan
  • get_coin_skips_block_tx_fks_and_mtp_without_time_lock (re-accept confirmed → MissingPrevout, Class A + recent-confirmed AlreadyHave, disconnected create parks)
  • confirm_wire_script_split fills recent-confirmed wtxid on IBD confirm_write
  • recent_confirmed_evicts_oldest_over_cap
  • handle_peer_frame_mempool_tx_and_inv_paths (genesis Class A + generated coinbase INV do not GETDATA)
  • park_orphan_is_graph_only re-insert fresh: false; parked_orphan_tx_is_not_logged_as_reject second tx has no park line
  • cargo clippy --workspace --all-targets -- -D warnings
  • Required CI green (fmt, deny, clippy, ast-grep, test, windows, macos, coverage)

rbitcoin-grok and others added 4 commits September 15, 2026 11:34
Spent or missing-vout prevouts on a confirmed create are MissingPrevout,
not orphanage, so we stop GETDATAing parents of txs we just stripped.
INV AlreadyHave includes Class A and a recent-confirmed txid/wtxid ring.
Re-delivery of an already-parked orphan still fetches parents (TTL) but
does not log a second txrelay: park line.

Co-authored-by: Cursor <cursoragent@cursor.com>
A missing vout on a tip-connected create is KnownUnavailable even if
is_outpoint_spent errors, so we do not park it. Pin recent-confirmed
clear/re-note so INV AlreadyHave coverage does not drop the line gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
Pick up leftover Esplora and fork-header coverage pins so the never-falls
line gate compares this branch against current master.
Coverage never-falls was red against current master. Drive confirm_write
with relay on, FIFO evict of the recent-confirmed ring, and park of a
spend whose create lost its Class A height.

Co-authored-by: Cursor <cursoragent@cursor.com>
@reardencode
reardencode merged commit f5f17ec into master Sep 15, 2026
16 checks passed
@rearden-grok
rearden-grok Bot deleted the net/orphan-spent-alreadyhave branch September 15, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant