Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show All 35 Lines | |||||
#include <univalue.h> | #include <univalue.h> | ||||
#include <event2/http.h> | #include <event2/http.h> | ||||
#include <functional> | #include <functional> | ||||
static const std::string WALLET_ENDPOINT_BASE = "/wallet/"; | static const std::string WALLET_ENDPOINT_BASE = "/wallet/"; | ||||
[[maybe_unused]] static inline bool GetAvoidReuseFlag(CWallet *const pwallet, | |||||
const UniValue ¶m) { | |||||
bool can_avoid_reuse = pwallet->IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE); | |||||
bool avoid_reuse = param.isNull() ? can_avoid_reuse : param.get_bool(); | |||||
if (avoid_reuse && !can_avoid_reuse) { | |||||
throw JSONRPCError( | |||||
RPC_WALLET_ERROR, | |||||
"wallet does not have the \"avoid reuse\" feature enabled"); | |||||
} | |||||
return avoid_reuse; | |||||
} | |||||
bool GetWalletNameFromJSONRPCRequest(const JSONRPCRequest &request, | bool GetWalletNameFromJSONRPCRequest(const JSONRPCRequest &request, | ||||
std::string &wallet_name) { | std::string &wallet_name) { | ||||
if (request.URI.substr(0, WALLET_ENDPOINT_BASE.size()) == | if (request.URI.substr(0, WALLET_ENDPOINT_BASE.size()) == | ||||
WALLET_ENDPOINT_BASE) { | WALLET_ENDPOINT_BASE) { | ||||
// wallet endpoint was used | // wallet endpoint was used | ||||
wallet_name = | wallet_name = | ||||
urlDecode(request.URI.substr(WALLET_ENDPOINT_BASE.size())); | urlDecode(request.URI.substr(WALLET_ENDPOINT_BASE.size())); | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 4,753 Lines • Show Last 20 Lines |