Skip to content

Commit 1f83839

Browse files
committed
[wallet] [tests] Test disallowed multiwallet params
Add a test to check that bitcoind fails to start when specifying -zapwallettxes, -salvagewallet and -upgradewallet when running in multiwallet mode.
1 parent 3476e3c commit 1f83839

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/functional/wallet_multiwallet.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,19 @@ def run_test(self):
9191
open(not_a_dir, 'a').close()
9292
self.nodes[0].assert_start_raises_init_error(['-walletdir=' + not_a_dir], 'Error: Specified -walletdir "' + not_a_dir + '" is not a directory')
9393

94+
self.log.info("Do not allow -zapwallettxes with multiwallet")
95+
self.nodes[0].assert_start_raises_init_error(['-zapwallettxes', '-wallet=w1', '-wallet=w2'], "Error: -zapwallettxes is only allowed with a single wallet file")
96+
self.nodes[0].assert_start_raises_init_error(['-zapwallettxes=1', '-wallet=w1', '-wallet=w2'], "Error: -zapwallettxes is only allowed with a single wallet file")
97+
self.nodes[0].assert_start_raises_init_error(['-zapwallettxes=2', '-wallet=w1', '-wallet=w2'], "Error: -zapwallettxes is only allowed with a single wallet file")
98+
99+
self.log.info("Do not allow -salvagewallet with multiwallet")
100+
self.nodes[0].assert_start_raises_init_error(['-salvagewallet', '-wallet=w1', '-wallet=w2'], "Error: -salvagewallet is only allowed with a single wallet file")
101+
self.nodes[0].assert_start_raises_init_error(['-salvagewallet=1', '-wallet=w1', '-wallet=w2'], "Error: -salvagewallet is only allowed with a single wallet file")
102+
103+
self.log.info("Do not allow -upgradewallet with multiwallet")
104+
self.nodes[0].assert_start_raises_init_error(['-upgradewallet', '-wallet=w1', '-wallet=w2'], "Error: -upgradewallet is only allowed with a single wallet file")
105+
self.nodes[0].assert_start_raises_init_error(['-upgradewallet=1', '-wallet=w1', '-wallet=w2'], "Error: -upgradewallet is only allowed with a single wallet file")
106+
94107
# if wallets/ doesn't exist, datadir should be the default wallet dir
95108
wallet_dir2 = data_dir('walletdir')
96109
os.rename(wallet_dir(), wallet_dir2)

0 commit comments

Comments
 (0)