Skip to content

Commit 3c1e75e

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25865: test: speedup wallet tests by whitelisting peers (immediate tx relay)
b21e522 test: speedup wallet tests by whitelisting peers (immediate tx relay) (Sebastian Falbesoner) Pull request description: In the course of testing #25297 by running all wallet-related functional tests (see bitcoin/bitcoin#25297 (comment)), I noticed that the run-time of those tests vary a lot between runs, in fact too much for a useful comparison. This PR fixes this by making the tests both more deterministic and also faster, using the good ol' immediate tx relay trick (parameter `[email protected]`). master branch: ``` wallet_abandonconflict.py --descriptors | ✓ Passed | 7 s wallet_abandonconflict.py --legacy-wallet | ✓ Passed | 23 s wallet_balance.py --descriptors | ✓ Passed | 17 s wallet_balance.py --legacy-wallet | ✓ Passed | 21 s wallet_basic.py --descriptors | ✓ Passed | 32 s wallet_basic.py --legacy-wallet | ✓ Passed | 56 s wallet_bumpfee.py --descriptors | ✓ Passed | 44 s wallet_bumpfee.py --legacy-wallet | ✓ Passed | 45 s wallet_groups.py --descriptors | ✓ Passed | 89 s wallet_groups.py --legacy-wallet | ✓ Passed | 94 s wallet_hd.py --descriptors | ✓ Passed | 7 s wallet_hd.py --legacy-wallet | ✓ Passed | 13 s wallet_importdescriptors.py --descriptors | ✓ Passed | 26 s wallet_listreceivedby.py --descriptors | ✓ Passed | 28 s wallet_listreceivedby.py --legacy-wallet | ✓ Passed | 18 s ALL | ✓ Passed | 520 s (accumulated) Runtime: 526 s ``` PR branch: ``` wallet_abandonconflict.py --descriptors | ✓ Passed | 7 s wallet_abandonconflict.py --legacy-wallet | ✓ Passed | 11 s wallet_balance.py --descriptors | ✓ Passed | 8 s wallet_balance.py --legacy-wallet | ✓ Passed | 8 s wallet_basic.py --descriptors | ✓ Passed | 29 s wallet_basic.py --legacy-wallet | ✓ Passed | 36 s wallet_bumpfee.py --descriptors | ✓ Passed | 39 s wallet_bumpfee.py --legacy-wallet | ✓ Passed | 32 s wallet_groups.py --descriptors | ✓ Passed | 39 s wallet_groups.py --legacy-wallet | ✓ Passed | 41 s wallet_hd.py --descriptors | ✓ Passed | 8 s wallet_hd.py --legacy-wallet | ✓ Passed | 11 s wallet_importdescriptors.py --descriptors | ✓ Passed | 17 s wallet_listreceivedby.py --descriptors | ✓ Passed | 7 s wallet_listreceivedby.py --legacy-wallet | ✓ Passed | 9 s ALL | ✓ Passed | 302 s (accumulated) Runtime: 309 s ``` Note that an alternative approach could be to whitelist peers by default for nodes in the functional test framework and only enable the trickle relay for the few tests where it's really needed. ACKs for top commit: naumenkogs: utACK b21e522 Tree-SHA512: ac3c8f8f5a401d1b6af60ece9c77e72449f18920c2cb4a1bd65fb4d62cf428779ebf4e1d29009a882977b2252922df4e7183541e0da8de932f8cd479149e8a86
2 parents 713ea7a + b21e522 commit 3c1e75e

9 files changed

+23
-1
lines changed

test/functional/wallet_abandonconflict.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class AbandonConflictTest(BitcoinTestFramework):
2424
def set_test_params(self):
2525
self.num_nodes = 2
2626
self.extra_args = [["-minrelaytxfee=0.00001"], []]
27+
# whitelist peers to speed up tx relay / mempool sync
28+
for args in self.extra_args:
29+
args.append("[email protected]")
2730

2831
def skip_test_if_missing_module(self):
2932
self.skip_if_no_wallet()

test/functional/wallet_balance.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ def set_test_params(self):
5555
['-limitdescendantcount=3', '-walletrejectlongchains=0'],
5656
[],
5757
]
58+
# whitelist peers to speed up tx relay / mempool sync
59+
for args in self.extra_args:
60+
args.append("[email protected]")
5861

5962
def skip_test_if_missing_module(self):
6063
self.skip_if_no_wallet()

test/functional/wallet_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class WalletTest(BitcoinTestFramework):
2626
def set_test_params(self):
2727
self.num_nodes = 4
2828
self.extra_args = [[
29-
"-dustrelayfee=0", "-walletrejectlongchains=0"
29+
"-dustrelayfee=0", "-walletrejectlongchains=0", "[email protected]"
3030
]] * self.num_nodes
3131
self.setup_clean_chain = True
3232
self.supports_cli = False

test/functional/wallet_bumpfee.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def set_test_params(self):
5353
"-walletrbf={}".format(i),
5454
"-mintxfee=0.00002",
5555
"-addresstype=bech32",
56+
5657
] for i in range(self.num_nodes)]
5758

5859
def skip_test_if_missing_module(self):

test/functional/wallet_groups.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ def set_test_params(self):
2626
["-maxapsfee=0.00002719"],
2727
["-maxapsfee=0.00002720"],
2828
]
29+
# whitelist peers to speed up tx relay / mempool sync
30+
for args in self.extra_args:
31+
args.append("[email protected]")
32+
2933
self.rpc_timeout = 480
3034

3135
def skip_test_if_missing_module(self):

test/functional/wallet_hd.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ def set_test_params(self):
2020
self.setup_clean_chain = True
2121
self.num_nodes = 2
2222
self.extra_args = [[], ['-keypool=0']]
23+
# whitelist peers to speed up tx relay / mempool sync
24+
for args in self.extra_args:
25+
args.append("[email protected]")
26+
2327
self.supports_cli = False
2428

2529
def skip_test_if_missing_module(self):

test/functional/wallet_importdescriptors.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ def set_test_params(self):
3535
self.extra_args = [["-addresstype=legacy"],
3636
["-addresstype=bech32", "-keypool=5"]
3737
]
38+
# whitelist peers to speed up tx relay / mempool sync
39+
for args in self.extra_args:
40+
args.append("[email protected]")
3841
self.setup_clean_chain = True
3942
self.wallet_names = []
4043

test/functional/wallet_listreceivedby.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
class ReceivedByTest(BitcoinTestFramework):
1919
def set_test_params(self):
2020
self.num_nodes = 2
21+
# whitelist peers to speed up tx relay / mempool sync
22+
self.extra_args = [["[email protected]"]] * self.num_nodes
2123

2224
def skip_test_if_missing_module(self):
2325
self.skip_if_no_wallet()

test/functional/wallet_listsinceblock.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class ListSinceBlockTest(BitcoinTestFramework):
2323
def set_test_params(self):
2424
self.num_nodes = 4
2525
self.setup_clean_chain = True
26+
# whitelist peers to speed up tx relay / mempool sync
27+
self.extra_args = [["[email protected]"]] * self.num_nodes
2628

2729
def skip_test_if_missing_module(self):
2830
self.skip_if_no_wallet()

0 commit comments

Comments
 (0)