From 5b2167fd30ea4384b93a0226e9fbef4650aa9438 Mon Sep 17 00:00:00 2001 From: Samuel Dobson Date: Fri, 3 Dec 2021 12:44:42 +1300 Subject: MOVEONLY: Move LoadWalletHelper to wallet/rpc/util --- src/wallet/rpcwallet.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'src/wallet/rpcwallet.cpp') diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index eb3ae2cd24..099969a609 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2191,37 +2191,6 @@ static RPCHelpMan listwallets() }; } -std::tuple, std::vector> LoadWalletHelper(WalletContext& context, UniValue load_on_start_param, const std::string wallet_name) -{ - DatabaseOptions options; - DatabaseStatus status; - options.require_existing = true; - bilingual_str error; - std::vector warnings; - std::optional load_on_start = load_on_start_param.isNull() ? std::nullopt : std::optional(load_on_start_param.get_bool()); - std::shared_ptr const wallet = LoadWallet(context, wallet_name, load_on_start, options, status, error, warnings); - - if (!wallet) { - // Map bad format to not found, since bad format is returned when the - // wallet directory exists, but doesn't contain a data file. - RPCErrorCode code = RPC_WALLET_ERROR; - switch (status) { - case DatabaseStatus::FAILED_NOT_FOUND: - case DatabaseStatus::FAILED_BAD_FORMAT: - code = RPC_WALLET_NOT_FOUND; - break; - case DatabaseStatus::FAILED_ALREADY_LOADED: - code = RPC_WALLET_ALREADY_LOADED; - break; - default: // RPC_WALLET_ERROR is returned for all other cases. - break; - } - throw JSONRPCError(code, error.original); - } - - return { wallet, warnings }; -} - static RPCHelpMan loadwallet() { return RPCHelpMan{"loadwallet", -- cgit v1.2.3