@@ -3409,29 +3409,27 @@ static UniValue listwallets(const Config &config,
34093409}
34103410
34113411UniValue loadwallet (const Config &config, const JSONRPCRequest &request) {
3412- if (request.fHelp || request.params .size () > 2 || request. params . size () < 1 ) {
3412+ if (request.fHelp || request.params .size () != 1 ) {
34133413 throw std::runtime_error (
34143414 " loadwallet \" filename\"\n "
34153415 " \n Loads a wallet from a wallet file or directory."
34163416 " \n Note that all wallet command-line options used when starting devaultd/DeVault-Core will be"
34173417 " \n applied to the new wallet (eg -zapwallettxes, upgradewallet, rescan, etc).\n "
34183418 " \n Arguments:\n "
34193419 " 1. \" filename\" (string, required) The wallet directory or .dat file.\n "
3420- " 2. \" password\" (string, optional) The wallet password or empty for none.\n "
34213420 " \n Result:\n "
34223421 " {\n "
34233422 " \" name\" : <wallet_name>, (string) The wallet name if loaded successfully.\n "
34243423 " \" warning\" : <warning>, (string) Warning message if wallet was not loaded cleanly.\n "
34253424 " }\n "
34263425 " \n Examples:\n " +
3427- HelpExampleCli (" loadwallet" , " \" test.dat\" \" password \" " ) +
3428- HelpExampleRpc (" loadwallet" , " \" test.dat\" \" password \" " ));
3426+ HelpExampleCli (" loadwallet" , " \" test.dat\" " ) +
3427+ HelpExampleRpc (" loadwallet" , " \" test.dat\" " ));
34293428 }
34303429
34313430 const CChainParams &chainParams = config.GetChainParams ();
34323431
34333432 std::string wallet_file = request.params [0 ].get_str ();
3434- std::string password = request.params [1 ].get_str ();
34353433 std::string error;
34363434 WalletLocation location (wallet_file);
34373435
@@ -3446,23 +3444,13 @@ UniValue loadwallet(const Config &config, const JSONRPCRequest &request) {
34463444 " Wallet file verification failed: " + error);
34473445 }
34483446
3449- SecureString pass (password);
3450-
3451- // Since Wallet should exist, then `words` are not used
3452- std::vector<std::string> words;
3453- bool use_bls = false ;
3454-
3455- std::shared_ptr<CWallet> const wallet = CWallet::CreateWalletFromFile (
3456- chainParams, location,
3457- pass,
3458- words,
3459- use_bls);
3447+ std::shared_ptr<CWallet> const wallet = CWallet::LoadWalletFromFile (chainParams, location);
34603448 if (!wallet) {
34613449 throw JSONRPCError (RPC_WALLET_ERROR, " Wallet loading failed." );
34623450 }
34633451 AddWallet (wallet);
34643452
3465- // // wallet->postInitProcess();
3453+ wallet->postInitProcess ();
34663454
34673455 UniValue obj (UniValue::VOBJ);
34683456 obj.pushKV (" name" , wallet->GetName ());
0 commit comments