From 6d50b2606ea9249627556051637080c3587b1b04 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Mon, 4 Nov 2019 09:44:11 +0100 Subject: [PATCH 1/2] test: add logging to wallet_avoidreuse.py --- test/functional/wallet_avoidreuse.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/functional/wallet_avoidreuse.py b/test/functional/wallet_avoidreuse.py index 3c8064ea2..4b87b3c10 100755 --- a/test/functional/wallet_avoidreuse.py +++ b/test/functional/wallet_avoidreuse.py @@ -87,6 +87,8 @@ class AvoidReuseTest(BitcoinTestFramework): def test_persistence(self): '''Test that wallet files persist the avoid_reuse flag.''' + self.log.info("Test wallet files persist avoid_reuse flag") + # Configure node 1 to use avoid_reuse self.nodes[1].setwalletflag('avoid_reuse') @@ -109,6 +111,8 @@ class AvoidReuseTest(BitcoinTestFramework): def test_immutable(self): '''Test immutable wallet flags''' + self.log.info("Test immutable wallet flags") + # Attempt to set the disable_private_keys flag; this should not work assert_raises_rpc_error(-8, "Wallet flag is immutable", self.nodes[1].setwalletflag, 'disable_private_keys') @@ -130,6 +134,7 @@ class AvoidReuseTest(BitcoinTestFramework): the avoid_reuse flag set to false. This means the 10 BTC send should succeed, where it fails in test_fund_send_fund_send. ''' + self.log.info("Test fund send fund send dirty") fundaddr = self.nodes[1].getnewaddress() retaddr = self.nodes[0].getnewaddress() @@ -183,6 +188,7 @@ class AvoidReuseTest(BitcoinTestFramework): [1] tries to spend 10 BTC (fails; dirty). [1] tries to spend 4 BTC (succeeds; change address sufficient) ''' + self.log.info("Test fund send fund send") fundaddr = self.nodes[1].getnewaddress() retaddr = self.nodes[0].getnewaddress() From 0e7c90eb37a687158c261ddd1ff9f1028a1e7012 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Mon, 4 Nov 2019 09:52:10 +0100 Subject: [PATCH 2/2] test: speed up wallet_avoidreuse.py Use -whitelist to speed up transaction relay. The wallet_avoidreuse.py test is not intended to test transaction relay/timing, so it should be fine to do this here. This greatly reduces test run time variability and speeds up the test by 2-3 times on average, e.g. on my system from 20-30 seconds down to 8-10 seconds. --- test/functional/wallet_avoidreuse.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/functional/wallet_avoidreuse.py b/test/functional/wallet_avoidreuse.py index 4b87b3c10..16925ea75 100755 --- a/test/functional/wallet_avoidreuse.py +++ b/test/functional/wallet_avoidreuse.py @@ -68,6 +68,9 @@ class AvoidReuseTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = False self.num_nodes = 2 + # This test isn't testing txn relay/timing, so set whitelist on the + # peers for instant txn relay. This speeds up the test run time 2-3x. + self.extra_args = [["-whitelist=127.0.0.1"]] * self.num_nodes def skip_test_if_missing_module(self): self.skip_if_no_wallet()