Repository navigation
test: wait for invalid-tx peers to be finalized in p2p_invalid_tx.py orphan checks - #8204
Conversation
p2p_invalid_tx.py intermittently fails at "Erased 1 orphan tx included or conflicted by block" because the node logs "Erased 2". The NonexistentInput template leaves an orphan that spends block1's coinbase, and that orphan is erased with its peer only when the node finalizes the peer. The node itself disconnects that peer (on SpendTooMuch) and lingers 100 ms before removing it, while getpeerinfo already hides it, so the test moves on at once. On a fast runner the first-pass orphan section takes less than 100 ms, so block_A, whose tx_withhold spends the same coinbase output, arrives first and erases the stale orphan as a conflict too. Wait until every peer from the invalid-tx loop has been finalized before starting the orphan checks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. WalkthroughThe functional test imports Estimated code review effort: 2 (Simple) | ~8 minutes Merge Risk:
|
|
✅ Final review complete — no blockers (commit adf47a2) · triage: low |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The test-only change correctly waits for finalization of all peers from the invalid-transaction loop before performing aggregate orphan-erasure assertions. The finalization log is emitted after EraseForPeer, peer IDs are monotonic, and the wait excludes the newly created orphan-test peers. The ASAN failure is unrelated to this change and occurs in feature_llmq_data_recovery.py; relevant test jobs passed, while multiprocess and TSAN jobs were still pending in the snapshot.
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.2-sol(effort low) — This is a small, well-contained functional-test synchronization fix that only waits for peer finalization before existing orphan checks and does not change production behavior. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort high); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 93% left, weekly 65% left; passed overgemini-3.8-flash-high(antigravity quota lookup failed) - Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— dash-core-commit-history (completed, effort medium); agentphase2-reviewer
Issue being fixed or feature implemented
p2p_invalid_tx.py --v1transportfails intest_orphan_tx_handling(first pass, line 248) with:Every job where it appeared failed all 3 attempts:
linux64_nowallet-testandlinux64_sqlite-teston 2026-11-03,linux64_nowallet-teston 2026-11-11 (including #8078), ondevelopitself on 2026-11-16, and on #8079 on 2026-11-19 (job). None of those PRs touch the test or the orphanage.The
NonexistentInputtemplate in the invalid-tx loop is stored as an orphan, and its second input spends block1's coinbase output 0. The node then disconnects that peer onSpendTooMuch, and erases the peer's orphans only when it finalizes the peer (FinalizeNode→EraseForPeer). For a peer it disconnected itself,DisconnectNodeslingers 100 ms before removing it, butgetpeerinfoalready hidesfDisconnectpeers, soreconnect_p2p()returns at once. On a fast runner the whole first-pass orphan section takes about 65 ms, soblock_Aarrives while the peer is still lingering.block_A'stx_withholdspends the same coinbase output, soEraseForBlockalso erases the stale orphan as a conflict, giving "Erased 2". In the failing log,Cleared nodestatefor that peer comes right after the block'sEraseForBlock. The second pass restarts the node, so it is unaffected.The check came in with #7551 (backport of bitcoin#19393). Upstream has no disconnect linger and has since stopped disconnecting peers over invalid txs, so there is no upstream fix to backport.
What was done?
Before the orphan checks, the test now waits until the debug log shows
Cleared nodestate for peer=Nfor every peer from the invalid-tx loop, which means their orphans have been erased. There's no RPC that exposes either peer finalization or the orphanage, so the debug log is the only signal to wait on.How Has This Been Tested?
--v1transport, 8 runs in parallel: the unchanged test hit the CI failure once in about 280 runs on a heavily loaded host, where the orphan section rarely finishes within 100 ms. Fixed test: 0 of 160, plus 0 of 24 with--v2transport.test/lint/lint-python.py(flake8) is clean for the file.Breaking Changes
None, test only.
Checklist:
🤖 Generated with Claude Code