Skip to content

Commit ce0a046

Browse files
MacroFakevijaydasmp
authored andcommitted
Merge 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 bitcoin#25297 by running all wallet-related functional tests (see 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 `-whitelist=noban@127.0.0.1`). 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
1 parent 4acf37e commit ce0a046

File tree

8 files changed

+22
-2
lines changed

8 files changed

+22
-2
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("-whitelist=noban@127.0.0.1")
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
@@ -53,6 +53,9 @@ def set_test_params(self):
5353
['-limitdescendantcount=3'], # Limit mempool descendants as a hack to have wallet txs rejected from the mempool
5454
[],
5555
]
56+
# whitelist peers to speed up tx relay / mempool sync
57+
for args in self.extra_args:
58+
args.append("-whitelist=noban@127.0.0.1")
5659

5760
def skip_test_if_missing_module(self):
5861
self.skip_if_no_wallet()

test/functional/wallet_basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ def set_test_params(self):
2727
self.num_nodes = 4
2828
if self.options.descriptors:
2929
self.extra_args = [[
30-
"-acceptnonstdtxn=1"
30+
"-acceptnonstdtxn=1", "-whitelist=noban@127.0.0.1"
3131
] for i in range(self.num_nodes)]
3232
else:
3333
self.extra_args = [[
34-
"-acceptnonstdtxn=1",
34+
"-acceptnonstdtxn=1", "-whitelist=noban@127.0.0.1",
3535
'-usehd={:d}'.format(i%2==0)
3636
] for i in range(self.num_nodes)]
3737
self.setup_clean_chain = True

test/functional/wallet_groups.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ def set_test_params(self):
2525
["-maxapsfee=0.00000293"],
2626
["-maxapsfee=0.00000294"],
2727
]
28+
# whitelist peers to speed up tx relay / mempool sync
29+
for args in self.extra_args:
30+
args.append("-whitelist=noban@127.0.0.1")
31+
2832
self.rpc_timeout = 480
2933
self.supports_cli = False
3034

test/functional/wallet_hd.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ def set_test_params(self):
1919
self.setup_clean_chain = True
2020
self.num_nodes = 2
2121
self.extra_args = [['-usehd=0'], ['-usehd=1', '-keypool=0']]
22+
# whitelist peers to speed up tx relay / mempool sync
23+
for args in self.extra_args:
24+
args.append("-whitelist=noban@127.0.0.1")
2225

2326
def setup_network(self):
2427
self.add_nodes(self.num_nodes, self.extra_args)

test/functional/wallet_importdescriptors.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def set_test_params(self):
3434
self.extra_args = [[],
3535
["-keypool=5"]
3636
]
37+
# whitelist peers to speed up tx relay / mempool sync
38+
for args in self.extra_args:
39+
args.append("-whitelist=noban@127.0.0.1")
3740
self.setup_clean_chain = True
3841
self.wallet_names = []
3942

test/functional/wallet_listreceivedby.py

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

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

test/functional/wallet_listsinceblock.py

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

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

0 commit comments

Comments
 (0)