@@ -211,5 +211,28 @@ def run_test(self):
211
211
# Fail to load if wallet file is a symlink
212
212
assert_raises_rpc_error (- 4 , "Wallet file verification failed: Invalid -wallet path 'w8_symlink'" , self .nodes [0 ].loadwallet , 'w8_symlink' )
213
213
214
+ self .log .info ("Test dynamic wallet creation." )
215
+
216
+ # Fail to create a wallet if it already exists.
217
+ assert_raises_rpc_error (- 4 , "Wallet w2 already exists." , self .nodes [0 ].createwallet , 'w2' )
218
+
219
+ # Successfully create a wallet with a new name
220
+ loadwallet_name = self .nodes [0 ].createwallet ('w9' )
221
+ assert_equal (loadwallet_name ['name' ], 'w9' )
222
+ w9 = node .get_wallet_rpc ('w9' )
223
+ assert_equal (w9 .getwalletinfo ()['walletname' ], 'w9' )
224
+
225
+ assert 'w9' in self .nodes [0 ].listwallets ()
226
+
227
+ # Successfully create a wallet using a full path
228
+ new_wallet_dir = os .path .join (self .options .tmpdir , 'new_walletdir' )
229
+ new_wallet_name = os .path .join (new_wallet_dir , 'w10' )
230
+ loadwallet_name = self .nodes [0 ].createwallet (new_wallet_name )
231
+ assert_equal (loadwallet_name ['name' ], new_wallet_name )
232
+ w10 = node .get_wallet_rpc (new_wallet_name )
233
+ assert_equal (w10 .getwalletinfo ()['walletname' ], new_wallet_name )
234
+
235
+ assert new_wallet_name in self .nodes [0 ].listwallets ()
236
+
214
237
if __name__ == '__main__' :
215
238
MultiWalletTest ().main ()
0 commit comments