rpcwallet: Make helper methods const on CWallet

This commit is contained in:
MarcoFalke
2019-05-02 10:10:28 -04:00
parent fad40ec915
commit fad13e925e
2 changed files with 6 additions and 6 deletions

View File

@ -70,14 +70,14 @@ std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& reques
return wallets.size() == 1 || (request.fHelp && wallets.size() > 0) ? wallets[0] : nullptr; return wallets.size() == 1 || (request.fHelp && wallets.size() > 0) ? wallets[0] : nullptr;
} }
std::string HelpRequiringPassphrase(CWallet * const pwallet) std::string HelpRequiringPassphrase(const CWallet* pwallet)
{ {
return pwallet && pwallet->IsCrypted() return pwallet && pwallet->IsCrypted()
? "\nRequires wallet passphrase to be set with walletpassphrase call." ? "\nRequires wallet passphrase to be set with walletpassphrase call."
: ""; : "";
} }
bool EnsureWalletIsAvailable(CWallet * const pwallet, bool avoidException) bool EnsureWalletIsAvailable(const CWallet* pwallet, bool avoidException)
{ {
if (pwallet) return true; if (pwallet) return true;
if (avoidException) return false; if (avoidException) return false;
@ -89,7 +89,7 @@ bool EnsureWalletIsAvailable(CWallet * const pwallet, bool avoidException)
"Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path)."); "Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path).");
} }
void EnsureWalletIsUnlocked(CWallet * const pwallet) void EnsureWalletIsUnlocked(const CWallet* pwallet)
{ {
if (pwallet->IsLocked()) { if (pwallet->IsLocked()) {
throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first.");

View File

@ -31,9 +31,9 @@ void RegisterWalletRPCCommands(interfaces::Chain& chain, std::vector<std::unique
*/ */
std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& request); std::shared_ptr<CWallet> GetWalletForJSONRPCRequest(const JSONRPCRequest& request);
std::string HelpRequiringPassphrase(CWallet *); std::string HelpRequiringPassphrase(const CWallet*);
void EnsureWalletIsUnlocked(CWallet *); void EnsureWalletIsUnlocked(const CWallet*);
bool EnsureWalletIsAvailable(CWallet *, bool avoidException); bool EnsureWalletIsAvailable(const CWallet*, bool avoidException);
UniValue getaddressinfo(const JSONRPCRequest& request); UniValue getaddressinfo(const JSONRPCRequest& request);
UniValue signrawtransactionwithwallet(const JSONRPCRequest& request); UniValue signrawtransactionwithwallet(const JSONRPCRequest& request);