mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 02:33:24 -03:00
RPC: Return external_signer in getwalletinfo
This commit is contained in:
parent
8c0f02c69d
commit
b75f4c89ec
2 changed files with 4 additions and 0 deletions
|
@ -57,6 +57,7 @@ static RPCHelpMan getwalletinfo()
|
|||
{RPCResult::Type::NUM, "progress", "scanning progress percentage [0.0, 1.0]"},
|
||||
}},
|
||||
{RPCResult::Type::BOOL, "descriptors", "whether this wallet uses descriptors for scriptPubKey management"},
|
||||
{RPCResult::Type::BOOL, "external_signer", "whether this wallet is configured to use an external signer such as a hardware wallet"},
|
||||
}},
|
||||
},
|
||||
RPCExamples{
|
||||
|
@ -117,6 +118,7 @@ static RPCHelpMan getwalletinfo()
|
|||
obj.pushKV("scanning", false);
|
||||
}
|
||||
obj.pushKV("descriptors", pwallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS));
|
||||
obj.pushKV("external_signer", pwallet->IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER));
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -72,10 +72,12 @@ class WalletSignerTest(BitcoinTestFramework):
|
|||
|
||||
self.nodes[1].createwallet(wallet_name='hww', disable_private_keys=True, descriptors=True, external_signer=True)
|
||||
hww = self.nodes[1].get_wallet_rpc('hww')
|
||||
assert_equal(hww.getwalletinfo()["external_signer"], True)
|
||||
|
||||
# Flag can't be set afterwards (could be added later for non-blank descriptor based watch-only wallets)
|
||||
self.nodes[1].createwallet(wallet_name='not_hww', disable_private_keys=True, descriptors=True, external_signer=False)
|
||||
not_hww = self.nodes[1].get_wallet_rpc('not_hww')
|
||||
assert_equal(not_hww.getwalletinfo()["external_signer"], False)
|
||||
assert_raises_rpc_error(-8, "Wallet flag is immutable: external_signer", not_hww.setwalletflag, "external_signer", True)
|
||||
|
||||
# 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)
|
||||
|
|
Loading…
Add table
Reference in a new issue