Skip to content

Commit 61f9d96

Browse files
MarcoFalkePastaPastaPasta
authored andcommitted
Merge bitcoin#22423: test: wallet_listtransactions improvements (speedup, cleanup, logging)
a006d7d test: add logging to wallet_listtransactions (Sebastian Falbesoner) 47915b1 test: remove unneeded/redundant code in wallet_listtransactions (Sebastian Falbesoner) fb6c6a7 test: speedup wallet_listtransactions by whitelisting peers (immediate tx relay) (Sebastian Falbesoner) Pull request description: This PR improves the test `wallet_listtransactions.py` in three ways: * speeds up runtime by a factor of 2-3x by using the good ol' immediate tx relay trick (`[email protected]`) * removes unneeded/redundant code * adds log messages, mostly by turning comments into `self.log.info(...)` calls ACKs for top commit: jonatack: ACK a006d7d kristapsk: ACK a006d7d Tree-SHA512: a91a19f5ebc4d05f0b96c5419683c4c57ac0ef44b64eeb8dd550bd72296fd3a2857a3ba83f755fe4b0b3bd06439973f226070b5d0ce2dee58344dae78cb50290
1 parent 0959f0f commit 61f9d96

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

test/functional/test_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@
117117
'mempool_updatefromblock.py',
118118
'p2p_tx_download.py',
119119
'wallet_dump.py --legacy-wallet',
120-
'wallet_listtransactions.py --legacy-wallet',
121-
'wallet_listtransactions.py --descriptors',
122120
'feature_multikeysporks.py',
123121
'feature_dip3_v19.py',
124122
'feature_llmq_signing.py', # NOTE: needs dash_hash to pass
@@ -179,6 +177,8 @@
179177
'wallet_createwallet.py --usecli',
180178
'wallet_createwallet.py --descriptors',
181179
'wallet_reorgsrestore.py',
180+
'wallet_listtransactions.py --legacy-wallet',
181+
'wallet_listtransactions.py --descriptors',
182182
'wallet_watchonly.py --legacy-wallet',
183183
'wallet_watchonly.py --usecli --legacy-wallet',
184184
'interface_http.py',

test/functional/wallet_listtransactions.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
class ListTransactionsTest(BitcoinTestFramework):
1515
def set_test_params(self):
1616
self.num_nodes = 2
17+
# This test isn't testing txn relay/timing, so set whitelist on the
18+
# peers for instant txn relay. This speeds up the test run time 2-3x.
19+
self.extra_args = [["[email protected]"]] * self.num_nodes
1720

1821
def skip_test_if_missing_module(self):
1922
self.skip_if_no_wallet()
2023

2124
def run_test(self):
22-
# Simple send, 0 to 1:
25+
self.log.info("Test simple send from node0 to node1")
2326
txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1)
2427
self.sync_all()
2528
assert_array_result(self.nodes[0].listtransactions(),
@@ -28,7 +31,7 @@ def run_test(self):
2831
assert_array_result(self.nodes[1].listtransactions(),
2932
{"txid": txid},
3033
{"category": "receive", "amount": Decimal("0.1"), "confirmations": 0})
31-
# mine a block, confirmations should change:
34+
self.log.info("Test confirmations change after mining a block")
3235
blockhash = self.nodes[0].generate(1)[0]
3336
blockheight = self.nodes[0].getblockheader(blockhash)['height']
3437
self.sync_all()
@@ -39,7 +42,7 @@ def run_test(self):
3942
{"txid": txid},
4043
{"category": "receive", "amount": Decimal("0.1"), "confirmations": 1, "blockhash": blockhash, "blockheight": blockheight})
4144

42-
# send-to-self:
45+
self.log.info("Test send-to-self on node0")
4346
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 0.2)
4447
assert_array_result(self.nodes[0].listtransactions(),
4548
{"txid": txid, "category": "send"},
@@ -48,7 +51,7 @@ def run_test(self):
4851
{"txid": txid, "category": "receive"},
4952
{"amount": Decimal("0.2")})
5053

51-
# sendmany from node1: twice to self, twice to node2:
54+
self.log.info("Test sendmany from node1: twice to self, twice to node0")
5255
send_to = {self.nodes[0].getnewaddress(): 0.11,
5356
self.nodes[1].getnewaddress(): 0.22,
5457
self.nodes[0].getnewaddress(): 0.33,
@@ -82,6 +85,7 @@ def run_test(self):
8285

8386
if not self.options.descriptors:
8487
# include_watchonly is a legacy wallet feature, so don't test it for descriptor wallets
88+
self.log.info("Test 'include_watchonly' feature (legacy wallet)")
8589
pubkey = self.nodes[1].getaddressinfo(self.nodes[1].getnewaddress())['pubkey']
8690
multisig = self.nodes[1].createmultisig(1, [pubkey])
8791
self.nodes[0].importaddress(multisig["redeemScript"], "watchonly", False, True)

0 commit comments

Comments
 (0)