Skip to content

Commit b75f4c8

Browse files
committed
RPC: Return external_signer in getwalletinfo
1 parent 8c0f02c commit b75f4c8

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/wallet/rpc/wallet.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static RPCHelpMan getwalletinfo()
5757
{RPCResult::Type::NUM, "progress", "scanning progress percentage [0.0, 1.0]"},
5858
}},
5959
{RPCResult::Type::BOOL, "descriptors", "whether this wallet uses descriptors for scriptPubKey management"},
60+
{RPCResult::Type::BOOL, "external_signer", "whether this wallet is configured to use an external signer such as a hardware wallet"},
6061
}},
6162
},
6263
RPCExamples{
@@ -117,6 +118,7 @@ static RPCHelpMan getwalletinfo()
117118
obj.pushKV("scanning", false);
118119
}
119120
obj.pushKV("descriptors", pwallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS));
121+
obj.pushKV("external_signer", pwallet->IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER));
120122
return obj;
121123
},
122124
};

test/functional/wallet_signer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,12 @@ def test_valid_signer(self):
7272

7373
self.nodes[1].createwallet(wallet_name='hww', disable_private_keys=True, descriptors=True, external_signer=True)
7474
hww = self.nodes[1].get_wallet_rpc('hww')
75+
assert_equal(hww.getwalletinfo()["external_signer"], True)
7576

7677
# Flag can't be set afterwards (could be added later for non-blank descriptor based watch-only wallets)
7778
self.nodes[1].createwallet(wallet_name='not_hww', disable_private_keys=True, descriptors=True, external_signer=False)
7879
not_hww = self.nodes[1].get_wallet_rpc('not_hww')
80+
assert_equal(not_hww.getwalletinfo()["external_signer"], False)
7981
assert_raises_rpc_error(-8, "Wallet flag is immutable: external_signer", not_hww.setwalletflag, "external_signer", True)
8082

8183
# assert_raises_rpc_error(-4, "Multiple signers found, please specify which to use", wallet_name='not_hww', disable_private_keys=True, descriptors=True, external_signer=True)

0 commit comments

Comments
 (0)