mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-26 23:45:54 +01:00
wallet: avoid reuse flags
Add m_avoid_address_reuse flag to coin control object. Add avoid_reuse wallet flag and accompanying strings/caveats.
This commit is contained in:
@@ -47,6 +47,17 @@
|
||||
|
||||
static const std::string WALLET_ENDPOINT_BASE = "/wallet/";
|
||||
|
||||
static inline bool GetAvoidReuseFlag(CWallet * const pwallet, const UniValue& param) {
|
||||
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, std::string& wallet_name)
|
||||
{
|
||||
if (request.URI.substr(0, WALLET_ENDPOINT_BASE.size()) == WALLET_ENDPOINT_BASE) {
|
||||
|
||||
Reference in New Issue
Block a user