From bc34536f514bc918590bfb8198a9b07a0fd146f6 Mon Sep 17 00:00:00 2001 From: lateminer <9951982+lateminer@users.noreply.github.com> Date: Wed, 31 Jan 2024 22:34:20 +0100 Subject: [PATCH] rpc: Add `unlocked_staking_only` info in `getwalletinfo` RPC --- src/wallet/rpc/wallet.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp index b5dd45ea4b..ac1db476f1 100644 --- a/src/wallet/rpc/wallet.cpp +++ b/src/wallet/rpc/wallet.cpp @@ -61,6 +61,7 @@ static RPCHelpMan getwalletinfo() {RPCResult::Type::STR_AMOUNT, "paytxfee", "the transaction fee configuration, set in " + CURRENCY_UNIT + "/kvB"}, {RPCResult::Type::STR_HEX, "hdseedid", /*optional=*/true, "the Hash160 of the HD seed (only present when HD is enabled)"}, {RPCResult::Type::BOOL, "private_keys_enabled", "false if privatekeys are disabled for this wallet (enforced watch-only wallet)"}, + {RPCResult::Type::BOOL, "unlocked_staking_only", /*optional=*/true, "true if wallet is unlocked for staking only"}, {RPCResult::Type::BOOL, "avoid_reuse", "whether this wallet tracks clean/dirty coins in terms of reuse"}, {RPCResult::Type::OBJ, "scanning", "current scanning details, or false if no scan is in progress", { @@ -117,6 +118,8 @@ static RPCHelpMan getwalletinfo() } if (pwallet->IsCrypted()) { obj.pushKV("unlocked_until", pwallet->nRelockTime); + bool stakingOnly = pwallet->m_wallet_unlock_staking_only; + obj.pushKV("unlocked_staking_only", stakingOnly); } obj.pushKV("paytxfee", ValueFromAmount(pwallet->m_pay_tx_fee.GetFeePerK())); obj.pushKV("private_keys_enabled", !pwallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS));