mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-19 05:45:05 +01:00
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.
This commit is contained in:
parent
6c6639ac9f
commit
310b0fde04
@ -88,6 +88,7 @@ BASE_SCRIPTS = [
|
|||||||
'wallet_hd.py',
|
'wallet_hd.py',
|
||||||
'wallet_hd.py --descriptors',
|
'wallet_hd.py --descriptors',
|
||||||
'wallet_backup.py',
|
'wallet_backup.py',
|
||||||
|
'wallet_backup.py --descriptors',
|
||||||
# vv Tests less than 5m vv
|
# vv Tests less than 5m vv
|
||||||
'mining_getblocktemplate_longpoll.py',
|
'mining_getblocktemplate_longpoll.py',
|
||||||
'feature_maxuploadtarget.py',
|
'feature_maxuploadtarget.py',
|
||||||
|
@ -135,11 +135,13 @@ class WalletBackupTest(BitcoinTestFramework):
|
|||||||
self.log.info("Backing up")
|
self.log.info("Backing up")
|
||||||
|
|
||||||
self.nodes[0].backupwallet(os.path.join(self.nodes[0].datadir, 'wallet.bak'))
|
self.nodes[0].backupwallet(os.path.join(self.nodes[0].datadir, 'wallet.bak'))
|
||||||
self.nodes[0].dumpwallet(os.path.join(self.nodes[0].datadir, 'wallet.dump'))
|
|
||||||
self.nodes[1].backupwallet(os.path.join(self.nodes[1].datadir, 'wallet.bak'))
|
self.nodes[1].backupwallet(os.path.join(self.nodes[1].datadir, 'wallet.bak'))
|
||||||
self.nodes[1].dumpwallet(os.path.join(self.nodes[1].datadir, 'wallet.dump'))
|
|
||||||
self.nodes[2].backupwallet(os.path.join(self.nodes[2].datadir, 'wallet.bak'))
|
self.nodes[2].backupwallet(os.path.join(self.nodes[2].datadir, 'wallet.bak'))
|
||||||
self.nodes[2].dumpwallet(os.path.join(self.nodes[2].datadir, 'wallet.dump'))
|
|
||||||
|
if not self.options.descriptors:
|
||||||
|
self.nodes[0].dumpwallet(os.path.join(self.nodes[0].datadir, 'wallet.dump'))
|
||||||
|
self.nodes[1].dumpwallet(os.path.join(self.nodes[1].datadir, 'wallet.dump'))
|
||||||
|
self.nodes[2].dumpwallet(os.path.join(self.nodes[2].datadir, 'wallet.dump'))
|
||||||
|
|
||||||
self.log.info("More transactions")
|
self.log.info("More transactions")
|
||||||
for _ in range(5):
|
for _ in range(5):
|
||||||
@ -183,29 +185,30 @@ class WalletBackupTest(BitcoinTestFramework):
|
|||||||
assert_equal(self.nodes[1].getbalance(), balance1)
|
assert_equal(self.nodes[1].getbalance(), balance1)
|
||||||
assert_equal(self.nodes[2].getbalance(), balance2)
|
assert_equal(self.nodes[2].getbalance(), balance2)
|
||||||
|
|
||||||
self.log.info("Restoring using dumped wallet")
|
if not self.options.descriptors:
|
||||||
self.stop_three()
|
self.log.info("Restoring using dumped wallet")
|
||||||
self.erase_three()
|
self.stop_three()
|
||||||
|
self.erase_three()
|
||||||
|
|
||||||
#start node2 with no chain
|
#start node2 with no chain
|
||||||
shutil.rmtree(os.path.join(self.nodes[2].datadir, self.chain, 'blocks'))
|
shutil.rmtree(os.path.join(self.nodes[2].datadir, self.chain, 'blocks'))
|
||||||
shutil.rmtree(os.path.join(self.nodes[2].datadir, self.chain, 'chainstate'))
|
shutil.rmtree(os.path.join(self.nodes[2].datadir, self.chain, 'chainstate'))
|
||||||
|
|
||||||
self.start_three()
|
self.start_three()
|
||||||
|
|
||||||
assert_equal(self.nodes[0].getbalance(), 0)
|
assert_equal(self.nodes[0].getbalance(), 0)
|
||||||
assert_equal(self.nodes[1].getbalance(), 0)
|
assert_equal(self.nodes[1].getbalance(), 0)
|
||||||
assert_equal(self.nodes[2].getbalance(), 0)
|
assert_equal(self.nodes[2].getbalance(), 0)
|
||||||
|
|
||||||
self.nodes[0].importwallet(os.path.join(self.nodes[0].datadir, 'wallet.dump'))
|
self.nodes[0].importwallet(os.path.join(self.nodes[0].datadir, 'wallet.dump'))
|
||||||
self.nodes[1].importwallet(os.path.join(self.nodes[1].datadir, 'wallet.dump'))
|
self.nodes[1].importwallet(os.path.join(self.nodes[1].datadir, 'wallet.dump'))
|
||||||
self.nodes[2].importwallet(os.path.join(self.nodes[2].datadir, 'wallet.dump'))
|
self.nodes[2].importwallet(os.path.join(self.nodes[2].datadir, 'wallet.dump'))
|
||||||
|
|
||||||
self.sync_blocks()
|
self.sync_blocks()
|
||||||
|
|
||||||
assert_equal(self.nodes[0].getbalance(), balance0)
|
assert_equal(self.nodes[0].getbalance(), balance0)
|
||||||
assert_equal(self.nodes[1].getbalance(), balance1)
|
assert_equal(self.nodes[1].getbalance(), balance1)
|
||||||
assert_equal(self.nodes[2].getbalance(), balance2)
|
assert_equal(self.nodes[2].getbalance(), balance2)
|
||||||
|
|
||||||
# Backup to source wallet file must fail
|
# Backup to source wallet file must fail
|
||||||
sourcePaths = [
|
sourcePaths = [
|
||||||
|
Loading…
Reference in New Issue
Block a user