15
15
class MultiWalletTest (BitcoinTestFramework ):
16
16
def set_test_params (self ):
17
17
self .setup_clean_chain = True
18
- self .num_nodes = 1
19
- self .extra_args = [['-wallet=w1' , '-wallet=w2' , '-wallet=w3' , '-wallet=w' ]]
18
+ self .num_nodes = 2
19
+ self .extra_args = [['-wallet=w1' , '-wallet=w2' , '-wallet=w3' , '-wallet=w' ], [] ]
20
20
self .supports_cli = True
21
21
22
22
def run_test (self ):
@@ -28,7 +28,7 @@ def run_test(self):
28
28
29
29
assert_equal (set (node .listwallets ()), {"w1" , "w2" , "w3" , "w" })
30
30
31
- self .stop_node ( 0 )
31
+ self .stop_nodes ( )
32
32
33
33
# should not initialize if there are duplicate wallets
34
34
self .assert_start_raises_init_error (0 , ['-wallet=w1' , '-wallet=w1' ], 'Error loading wallet w1. Duplicate -wallet filename specified.' )
@@ -59,19 +59,21 @@ def run_test(self):
59
59
assert_equal (set (node .listwallets ()), {"w4" , "w5" })
60
60
w5 = wallet ("w5" )
61
61
w5 .generate (1 )
62
- self .stop_node (0 )
63
62
64
63
# now if wallets/ exists again, but the rootdir is specified as the walletdir, w4 and w5 should still be loaded
65
64
os .rename (wallet_dir2 , wallet_dir ())
66
- self .start_node (0 , ['-wallet=w4' , '-wallet=w5' , '-walletdir=' + data_dir ()])
65
+ self .restart_node (0 , ['-wallet=w4' , '-wallet=w5' , '-walletdir=' + data_dir ()])
67
66
assert_equal (set (node .listwallets ()), {"w4" , "w5" })
68
67
w5 = wallet ("w5" )
69
68
w5_info = w5 .getwalletinfo ()
70
69
assert_equal (w5_info ['immature_balance' ], 50 )
71
70
72
- self .stop_node (0 )
71
+ competing_wallet_dir = os .path .join (self .options .tmpdir , 'competing_walletdir' )
72
+ os .mkdir (competing_wallet_dir )
73
+ self .restart_node (0 , ['-walletdir=' + competing_wallet_dir ])
74
+ self .assert_start_raises_init_error (1 , ['-walletdir=' + competing_wallet_dir ], 'Cannot obtain a lock on wallet directory' )
73
75
74
- self .start_node (0 , self .extra_args [0 ])
76
+ self .restart_node (0 , self .extra_args [0 ])
75
77
76
78
w1 = wallet ("w1" )
77
79
w2 = wallet ("w2" )
0 commit comments