Skip to content

Commit 2d7ea20

Browse files
committed
Merge bitcoin#24307: RPC: Return external_signer in getwalletinfo
b75f4c8 RPC: Return external_signer in getwalletinfo (Kristaps Kaupe) Pull request description: Add `external_signer` to the result object of `getwalletinfo` RPC which indicates whether `WALLET_FLAG_EXTERNAL_SIGNER` flag is set for the wallet. ACKs for top commit: S3RK: utACK b75f4c8 achow101: ACK b75f4c8 prayank23: utACK bitcoin@b75f4c8 brunoerg: utACK b75f4c8 Tree-SHA512: 066ccb97541fd4dc3d9728834645db714a3c8c93ccf29142811af4d79cfb9440a97bbb6c845434a909bc6e1775ef3737fcbb368c1f0582bc63973f6deb17a45f
2 parents b79c40b + b75f4c8 commit 2d7ea20

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)