| 51 | } |
| 52 | |
| 53 | std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& request) |
| 54 | { |
| 55 | std::string wallet_name; |
| 56 | if (GetWalletNameFromJSONRPCRequest(request, wallet_name)) { |
| 57 | std::shared_ptr<CWallet> pwallet = GetWallet(wallet_name); |
| 58 | if (!pwallet) throw JSONRPCError(RPC_WALLET_NOT_FOUND, "Requested wallet does not exist or is not loaded"); |
| 59 | return pwallet; |
| 60 | } |
| 61 | |
| 62 | std::vector<std::shared_ptr<CWallet>> wallets = GetWallets(); |
| 63 | return wallets.size() == 1 || (request.fHelp && wallets.size() > 0) ? wallets[0] : nullptr; |
| 64 | } |
| 65 | |
| 66 | std::string HelpRequiringPassphrase(CWallet * const pwallet) |
| 67 | { |
no test coverage detected