test: Add missing syncwithvalidationinterfacequeue
What changed, and why it matters
This commit fixes a timing issue in a Bitcoin Core functional test. The test checks that orphan transactions are removed when a block connects, but the check was running before a background queue had finished processing the block. Adding a synchronization call makes the test wait for that background work, so the test reliably sees the expected log message. It does not change production node behavior or fix a security bug in the Bitcoin protocol.
No security action required. Treat as a normal test reliability improvement. Reviewers may optionally verify that the synchronization helper is the idiomatic way to wait for the validation interface queue in this test framework.
Security signals we found
No production code changed
Test-only synchronization fix
No memory safety, cryptographic, or consensus changes
No privilege escalation or remote attack surface introduced
Evidence from the diff
The change adds node.syncwithvalidationinterfacequeue() after two send_blocks_and_test(..., success=True) calls in test/functional/p2p_invalid_tx.py. The test asserts that a specific debug log line (‘Erased 1 orphan transaction(s) included or conflicted by block’) appears after a block is connected. That log is emitted by the validation interface queue thread when it processes the BlockConnected event and erases the orphan. Without synchronization, the assertion could run before the background thread completes, making the test flaky. The patch only affects test code; no consensus, networking, or mempool logic in the production binary is modified.
Changed components
test/functional/p2p_invalid_tx.pyInspect captured patch +2 / −0
diff --git a/test/functional/p2p_invalid_tx.py b/test/functional/p2p_invalid_tx.py
index 8510a95c..c5d0cf98 100755
--- a/test/functional/p2p_invalid_tx.py
+++ b/test/functional/p2p_invalid_tx.py
@@ -179,6 +179,7 @@ class InvalidTxRequestTest(BitcoinTestFramework):
self.log.info('Send the block that includes the previous orphan ... ')
with node.assert_debug_log(["Erased 1 orphan transaction(s) included or conflicted by block"]):
node.p2ps[0].send_blocks_and_test([block_A], node, success=True)
+ node.syncwithvalidationinterfacequeue()
self.log.info('Test that a transaction in the orphan pool conflicts with a new tip block causes erase this transaction from the orphan pool')
tx_withhold_until_block_B = CTransaction()
@@ -205,6 +206,7 @@ class InvalidTxRequestTest(BitcoinTestFramework):
self.log.info('Send the block that includes a transaction which conflicts with the previous orphan ... ')
with node.assert_debug_log(["Erased 1 orphan transaction(s) included or conflicted by block"]):
node.p2ps[0].send_blocks_and_test([block_B], node, success=True)
+ node.syncwithvalidationinterfacequeue()
if __name__ == '__main__':
Why this scored 13/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.