mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-29 10:19:26 +02:00
rpcwallet: Make helper methods const on CWallet
This commit is contained in:
@ -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.");
|
||||||
|
@ -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);
|
||||||
|
Reference in New Issue
Block a user