@@ -109,16 +109,16 @@ def stop_three(self):
109
109
self .stop_node (2 )
110
110
111
111
def erase_three (self ):
112
- os .remove (os .path .join (self .nodes [0 ].datadir , self . chain , 'wallets' , self .default_wallet_name , self .wallet_data_filename ))
113
- os .remove (os .path .join (self .nodes [1 ].datadir , self . chain , 'wallets' , self .default_wallet_name , self .wallet_data_filename ))
114
- os .remove (os .path .join (self .nodes [2 ].datadir , self . chain , 'wallets' , self .default_wallet_name , self .wallet_data_filename ))
112
+ os .remove (os .path .join (self .nodes [0 ].wallets_path , self .default_wallet_name , self .wallet_data_filename ))
113
+ os .remove (os .path .join (self .nodes [1 ].wallets_path , self .default_wallet_name , self .wallet_data_filename ))
114
+ os .remove (os .path .join (self .nodes [2 ].wallets_path , self .default_wallet_name , self .wallet_data_filename ))
115
115
116
116
def restore_invalid_wallet (self ):
117
117
node = self .nodes [3 ]
118
118
invalid_wallet_file = os .path .join (self .nodes [0 ].datadir , 'invalid_wallet_file.bak' )
119
119
open (invalid_wallet_file , 'a' , encoding = "utf8" ).write ('invald wallet' )
120
120
wallet_name = "res0"
121
- not_created_wallet_file = os .path .join (node .datadir , self . chain , 'wallets' , wallet_name )
121
+ not_created_wallet_file = os .path .join (node .wallets_path , wallet_name )
122
122
error_message = "Wallet file verification failed. Failed to load database path '{}'. Data is not in recognized format." .format (not_created_wallet_file )
123
123
assert_raises_rpc_error (- 18 , error_message , node .restorewallet , wallet_name , invalid_wallet_file )
124
124
assert not os .path .exists (not_created_wallet_file )
@@ -128,14 +128,14 @@ def restore_nonexistent_wallet(self):
128
128
nonexistent_wallet_file = os .path .join (self .nodes [0 ].datadir , 'nonexistent_wallet.bak' )
129
129
wallet_name = "res0"
130
130
assert_raises_rpc_error (- 8 , "Backup file does not exist" , node .restorewallet , wallet_name , nonexistent_wallet_file )
131
- not_created_wallet_file = os .path .join (node .datadir , self . chain , 'wallets' , wallet_name )
131
+ not_created_wallet_file = os .path .join (node .wallets_path , wallet_name )
132
132
assert not os .path .exists (not_created_wallet_file )
133
133
134
134
def restore_wallet_existent_name (self ):
135
135
node = self .nodes [3 ]
136
136
backup_file = os .path .join (self .nodes [0 ].datadir , 'wallet.bak' )
137
137
wallet_name = "res0"
138
- wallet_file = os .path .join (node .datadir , self . chain , 'wallets' , wallet_name )
138
+ wallet_file = os .path .join (node .wallets_path , wallet_name )
139
139
error_message = "Failed to create database path '{}'. Database already exists." .format (wallet_file )
140
140
assert_raises_rpc_error (- 36 , error_message , node .restorewallet , wallet_name , backup_file )
141
141
assert os .path .exists (wallet_file )
@@ -206,9 +206,9 @@ def run_test(self):
206
206
self .nodes [3 ].restorewallet ("res1" , backup_file_1 )
207
207
self .nodes [3 ].restorewallet ("res2" , backup_file_2 )
208
208
209
- assert os .path .exists (os .path .join (self .nodes [3 ].datadir , self . chain , 'wallets' , "res0" ))
210
- assert os .path .exists (os .path .join (self .nodes [3 ].datadir , self . chain , 'wallets' , "res1" ))
211
- assert os .path .exists (os .path .join (self .nodes [3 ].datadir , self . chain , 'wallets' , "res2" ))
209
+ assert os .path .exists (os .path .join (self .nodes [3 ].wallets_path , "res0" ))
210
+ assert os .path .exists (os .path .join (self .nodes [3 ].wallets_path , "res1" ))
211
+ assert os .path .exists (os .path .join (self .nodes [3 ].wallets_path , "res2" ))
212
212
213
213
res0_rpc = self .nodes [3 ].get_wallet_rpc ("res0" )
214
214
res1_rpc = self .nodes [3 ].get_wallet_rpc ("res1" )
@@ -226,8 +226,8 @@ def run_test(self):
226
226
self .erase_three ()
227
227
228
228
#start node2 with no chain
229
- shutil .rmtree (os .path .join (self .nodes [2 ].datadir , self . chain , 'blocks' ))
230
- shutil .rmtree (os .path .join (self .nodes [2 ].datadir , self . chain , 'chainstate' ))
229
+ shutil .rmtree (os .path .join (self .nodes [2 ].chain_path , 'blocks' ))
230
+ shutil .rmtree (os .path .join (self .nodes [2 ].chain_path , 'chainstate' ))
231
231
232
232
self .start_three (["-nowallet" ])
233
233
self .init_three ()
@@ -248,10 +248,10 @@ def run_test(self):
248
248
249
249
# Backup to source wallet file must fail
250
250
sourcePaths = [
251
- os .path .join (self .nodes [0 ].datadir , self . chain , 'wallets' , self .default_wallet_name , self .wallet_data_filename ),
252
- os .path .join (self .nodes [0 ].datadir , self . chain , 'wallets' , '.' , self .default_wallet_name , self .wallet_data_filename ),
253
- os .path .join (self .nodes [0 ].datadir , self . chain , 'wallets' , self .default_wallet_name ),
254
- os .path .join (self .nodes [0 ].datadir , self . chain , 'wallets' )]
251
+ os .path .join (self .nodes [0 ].wallets_path , self .default_wallet_name , self .wallet_data_filename ),
252
+ os .path .join (self .nodes [0 ].wallets_path , '.' , self .default_wallet_name , self .wallet_data_filename ),
253
+ os .path .join (self .nodes [0 ].wallets_path , self .default_wallet_name ),
254
+ os .path .join (self .nodes [0 ].wallets_path )]
255
255
256
256
for sourcePath in sourcePaths :
257
257
assert_raises_rpc_error (- 4 , "backup failed" , self .nodes [0 ].backupwallet , sourcePath )
0 commit comments