Skip to content

Commit 310b0fd

Browse files
committed
Run dumpwallet for legacy wallets only in wallet_backup.py
Descriptor wallets don't support dumpwallet, so make the tests that do dumpwallet legacy wallet only.
1 parent 6c6639a commit 310b0fd

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

test/functional/test_runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
'wallet_hd.py',
8989
'wallet_hd.py --descriptors',
9090
'wallet_backup.py',
91+
'wallet_backup.py --descriptors',
9192
# vv Tests less than 5m vv
9293
'mining_getblocktemplate_longpoll.py',
9394
'feature_maxuploadtarget.py',

test/functional/wallet_backup.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,13 @@ def run_test(self):
135135
self.log.info("Backing up")
136136

137137
self.nodes[0].backupwallet(os.path.join(self.nodes[0].datadir, 'wallet.bak'))
138-
self.nodes[0].dumpwallet(os.path.join(self.nodes[0].datadir, 'wallet.dump'))
139138
self.nodes[1].backupwallet(os.path.join(self.nodes[1].datadir, 'wallet.bak'))
140-
self.nodes[1].dumpwallet(os.path.join(self.nodes[1].datadir, 'wallet.dump'))
141139
self.nodes[2].backupwallet(os.path.join(self.nodes[2].datadir, 'wallet.bak'))
142-
self.nodes[2].dumpwallet(os.path.join(self.nodes[2].datadir, 'wallet.dump'))
140+
141+
if not self.options.descriptors:
142+
self.nodes[0].dumpwallet(os.path.join(self.nodes[0].datadir, 'wallet.dump'))
143+
self.nodes[1].dumpwallet(os.path.join(self.nodes[1].datadir, 'wallet.dump'))
144+
self.nodes[2].dumpwallet(os.path.join(self.nodes[2].datadir, 'wallet.dump'))
143145

144146
self.log.info("More transactions")
145147
for _ in range(5):
@@ -183,29 +185,30 @@ def run_test(self):
183185
assert_equal(self.nodes[1].getbalance(), balance1)
184186
assert_equal(self.nodes[2].getbalance(), balance2)
185187

186-
self.log.info("Restoring using dumped wallet")
187-
self.stop_three()
188-
self.erase_three()
188+
if not self.options.descriptors:
189+
self.log.info("Restoring using dumped wallet")
190+
self.stop_three()
191+
self.erase_three()
189192

190-
#start node2 with no chain
191-
shutil.rmtree(os.path.join(self.nodes[2].datadir, self.chain, 'blocks'))
192-
shutil.rmtree(os.path.join(self.nodes[2].datadir, self.chain, 'chainstate'))
193+
#start node2 with no chain
194+
shutil.rmtree(os.path.join(self.nodes[2].datadir, self.chain, 'blocks'))
195+
shutil.rmtree(os.path.join(self.nodes[2].datadir, self.chain, 'chainstate'))
193196

194-
self.start_three()
197+
self.start_three()
195198

196-
assert_equal(self.nodes[0].getbalance(), 0)
197-
assert_equal(self.nodes[1].getbalance(), 0)
198-
assert_equal(self.nodes[2].getbalance(), 0)
199+
assert_equal(self.nodes[0].getbalance(), 0)
200+
assert_equal(self.nodes[1].getbalance(), 0)
201+
assert_equal(self.nodes[2].getbalance(), 0)
199202

200-
self.nodes[0].importwallet(os.path.join(self.nodes[0].datadir, 'wallet.dump'))
201-
self.nodes[1].importwallet(os.path.join(self.nodes[1].datadir, 'wallet.dump'))
202-
self.nodes[2].importwallet(os.path.join(self.nodes[2].datadir, 'wallet.dump'))
203+
self.nodes[0].importwallet(os.path.join(self.nodes[0].datadir, 'wallet.dump'))
204+
self.nodes[1].importwallet(os.path.join(self.nodes[1].datadir, 'wallet.dump'))
205+
self.nodes[2].importwallet(os.path.join(self.nodes[2].datadir, 'wallet.dump'))
203206

204-
self.sync_blocks()
207+
self.sync_blocks()
205208

206-
assert_equal(self.nodes[0].getbalance(), balance0)
207-
assert_equal(self.nodes[1].getbalance(), balance1)
208-
assert_equal(self.nodes[2].getbalance(), balance2)
209+
assert_equal(self.nodes[0].getbalance(), balance0)
210+
assert_equal(self.nodes[1].getbalance(), balance1)
211+
assert_equal(self.nodes[2].getbalance(), balance2)
209212

210213
# Backup to source wallet file must fail
211214
sourcePaths = [

0 commit comments

Comments
 (0)