Skip to content

Commit 2706162

Browse files
committed
Merge #17362: test: speed up wallet_avoidreuse, add logging
0e7c90e test: speed up wallet_avoidreuse.py (Jon Atack) 6d50b26 test: add logging to wallet_avoidreuse.py (Jon Atack) Pull request description: Inspired by PRs #17340 and #15881. - add logging - pass -whitelist in `set_test_params` to speed up transaction relay `wallet_avoidreuse.py` is not intended to test P2P transaction relay/timing, so it should be fine to do this here. This reduces test run time variability and speeds up the test by 2-3 times on average. Test run times in seconds: - before: 20, 24, 22, 17, 27, 40, 30 - after: 10, 10, 8, 9, 10, 7, 8 ACKs for top commit: MarcoFalke: ACK 0e7c90e 🐊 fanquake: ACK 0e7c90e Tree-SHA512: 6d954a0aaf402c9594201626b59d29263479059e68fa5155bb44ed973cd0c3347729dd78b78b4d5a2275e45da365dc1afb4cc7e3293dea33fcc2e3e83a39faf5
2 parents 772673d + 0e7c90e commit 2706162

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/functional/wallet_avoidreuse.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ class AvoidReuseTest(BitcoinTestFramework):
6868
def set_test_params(self):
6969
self.setup_clean_chain = False
7070
self.num_nodes = 2
71+
# This test isn't testing txn relay/timing, so set whitelist on the
72+
# peers for instant txn relay. This speeds up the test run time 2-3x.
73+
self.extra_args = [["-whitelist=127.0.0.1"]] * self.num_nodes
7174

7275
def skip_test_if_missing_module(self):
7376
self.skip_if_no_wallet()
@@ -87,6 +90,8 @@ def run_test(self):
8790

8891
def test_persistence(self):
8992
'''Test that wallet files persist the avoid_reuse flag.'''
93+
self.log.info("Test wallet files persist avoid_reuse flag")
94+
9095
# Configure node 1 to use avoid_reuse
9196
self.nodes[1].setwalletflag('avoid_reuse')
9297

@@ -109,6 +114,8 @@ def test_persistence(self):
109114

110115
def test_immutable(self):
111116
'''Test immutable wallet flags'''
117+
self.log.info("Test immutable wallet flags")
118+
112119
# Attempt to set the disable_private_keys flag; this should not work
113120
assert_raises_rpc_error(-8, "Wallet flag is immutable", self.nodes[1].setwalletflag, 'disable_private_keys')
114121

@@ -130,6 +137,7 @@ def test_fund_send_fund_senddirty(self):
130137
the avoid_reuse flag set to false. This means the 10 BTC send should succeed,
131138
where it fails in test_fund_send_fund_send.
132139
'''
140+
self.log.info("Test fund send fund send dirty")
133141

134142
fundaddr = self.nodes[1].getnewaddress()
135143
retaddr = self.nodes[0].getnewaddress()
@@ -183,6 +191,7 @@ def test_fund_send_fund_send(self):
183191
[1] tries to spend 10 BTC (fails; dirty).
184192
[1] tries to spend 4 BTC (succeeds; change address sufficient)
185193
'''
194+
self.log.info("Test fund send fund send")
186195

187196
fundaddr = self.nodes[1].getnewaddress()
188197
retaddr = self.nodes[0].getnewaddress()

0 commit comments

Comments
 (0)