test: improve `wallet_assumeutxo` func test
What changed, and why it matters
This commit only changes a single functional test file. It reduces the number of blocks generated in a test from 500 to 200 and unloads a wallet earlier to make the test run faster and produce fewer chain notifications. There is no change to production code, no bug fix, and no security-relevant behavior change.
No security action needed. This is a routine test-maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies test/functional/wallet_assumeutxo.py. It adds n3.unloadwallet(‘w’) before testing that a backup from before the snapshot height cannot be loaded during background sync, and changes self.generate(n3, nblocks=500, …) to nblocks=200 in test_restore_wallet_pruneheight. The accompanying commit message explains these are test optimizations to reduce block generation and wallet chain notifications. No consensus, networking, wallet, or cryptographic code is affected.
Changed components
test/functional/wallet_assumeutxo.pyInspect captured patch +3 / −2
diff --git a/test/functional/wallet_assumeutxo.py b/test/functional/wallet_assumeutxo.py
index 926d4b16..e7c61885 100755
--- a/test/functional/wallet_assumeutxo.py
+++ b/test/functional/wallet_assumeutxo.py
@@ -85,15 +85,16 @@ class AssumeutxoTest(BitcoinTestFramework):
# Balance of w wallet is still 0 because n3 has not synced yet
assert_equal(n3.getbalance(), 0)
+ n3.unloadwallet("w")
self.log.info("Backup from before the snapshot height can't be loaded during background sync (pruned node)")
assert_raises_rpc_error(-4, expected_error_message, n3.restorewallet, "w2", "backup_w2.dat")
def test_restore_wallet_pruneheight(self, n3):
self.log.info("Ensuring wallet can't be restored from a backup that was created before the pruneheight (pruned node)")
self.complete_background_validation(n3)
- # After background sync, pruneheight is reset to 0, so mine 500 blocks
+ # After background sync, pruneheight is reset to 0, so mine 200 blocks
# and prune the chain again
- self.generate(n3, nblocks=500, sync_fun=self.no_op)
+ self.generate(n3, nblocks=200, sync_fun=self.no_op)
assert_equal(n3.pruneblockchain(FINAL_HEIGHT), 298) # 298 is the height of the last block pruned (pruneheight 299)
error_message = "Wallet loading failed. Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of a pruned node)"
# This backup (backup_w2.dat) was created at height 199, so it can't be restored in a node with a pruneheight of 299
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.