test: Wait for txospender index to be synced in rpc_gettxspendingprevout
What changed, and why it matters
This is a test-only change. It adds two lines to a single functional test file to wait for an internal index to finish syncing before continuing the test. There is no change to production Bitcoin Core code, no wallet or consensus logic is touched, and no security vulnerability is present in the commit.
No security action required. Treat as a normal test reliability improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies test/functional/rpc_gettxspendingprevout.py to call self.wait_until() for node0 and node1 until getindexinfo()[‘txospenderindex’][‘synced’] is true. This fixes a race condition in the test harness where the txospender index may lag behind the mempool/chain state. The change is purely additive synchronization in test code.
Changed components
test/functional/rpc_gettxspendingprevout.pyInspect captured patch +2 / −0
diff --git a/test/functional/rpc_gettxspendingprevout.py b/test/functional/rpc_gettxspendingprevout.py
index ecf42e0a..972056e6 100755
--- a/test/functional/rpc_gettxspendingprevout.py
+++ b/test/functional/rpc_gettxspendingprevout.py
@@ -77,6 +77,8 @@ class GetTxSpendingPrevoutTest(BitcoinTestFramework):
txidA, txidB, txidC, txidD, txidE, txidF, txidG, txidH = [tx["txid"] for tx in txs]
self.sync_mempools()
+ self.wait_until(lambda: node0.getindexinfo()["txospenderindex"]["synced"])
+ self.wait_until(lambda: node1.getindexinfo()["txospenderindex"]["synced"])
mempool = node0.getrawmempool()
assert_equal(len(mempool), 8)
for tx in txs:
Why this scored 15/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.