|
|
@ -2544,7 +2544,6 @@ static UniValue loadwallet(const JSONRPCRequest& request)
|
|
|
|
}.ToString());
|
|
|
|
}.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
WalletLocation location(request.params[0].get_str());
|
|
|
|
WalletLocation location(request.params[0].get_str());
|
|
|
|
std::string error;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!location.Exists()) {
|
|
|
|
if (!location.Exists()) {
|
|
|
|
throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Wallet " + location.GetName() + " not found.");
|
|
|
|
throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Wallet " + location.GetName() + " not found.");
|
|
|
@ -2556,18 +2555,9 @@ static UniValue loadwallet(const JSONRPCRequest& request)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string warning;
|
|
|
|
std::string error, warning;
|
|
|
|
if (!CWallet::Verify(*g_rpc_interfaces->chain, location, false, error, warning)) {
|
|
|
|
std::shared_ptr<CWallet> const wallet = LoadWallet(*g_rpc_interfaces->chain, location, error, warning);
|
|
|
|
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet file verification failed: " + error);
|
|
|
|
if (!wallet) throw JSONRPCError(RPC_WALLET_ERROR, error);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<CWallet> const wallet = CWallet::CreateWalletFromFile(*g_rpc_interfaces->chain, location);
|
|
|
|
|
|
|
|
if (!wallet) {
|
|
|
|
|
|
|
|
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet loading failed.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
AddWallet(wallet);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wallet->postInitProcess();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UniValue obj(UniValue::VOBJ);
|
|
|
|
UniValue obj(UniValue::VOBJ);
|
|
|
|
obj.pushKV("name", wallet->GetName());
|
|
|
|
obj.pushKV("name", wallet->GetName());
|
|
|
|