Skip to content

Commit e6cf0ed

Browse files
committed
wallet, rpc: listdescriptors does not need unlocked
With the last hardened xpub cache, we don't neeed to have the wallet be unlocked for listdescriptors.
1 parent 3280704 commit e6cf0ed

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/wallet/rpcdump.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,8 +1787,6 @@ RPCHelpMan listdescriptors()
17871787
throw JSONRPCError(RPC_WALLET_ERROR, "listdescriptors is not available for non-descriptor wallets");
17881788
}
17891789

1790-
EnsureWalletIsUnlocked(*wallet);
1791-
17921790
LOCK(wallet->cs_wallet);
17931791

17941792
UniValue descriptors(UniValue::VARR);

src/wallet/scriptpubkeyman.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,9 +2269,6 @@ const std::vector<CScript> DescriptorScriptPubKeyMan::GetScriptPubKeys() const
22692269
bool DescriptorScriptPubKeyMan::GetDescriptorString(std::string& out) const
22702270
{
22712271
LOCK(cs_desc_man);
2272-
if (m_storage.IsLocked()) {
2273-
return false;
2274-
}
22752272

22762273
FlatSigningProvider provider;
22772274
provider.keys = GetKeys();

test/functional/wallet_listdescriptors.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ def run_test(self):
7272
}
7373
assert_equal(expected, wallet.listdescriptors())
7474

75+
self.log.info("Test listdescriptors with encrypted wallet")
76+
wallet.encryptwallet("pass")
77+
assert_equal(expected, wallet.listdescriptors())
78+
7579
self.log.info('Test non-active non-range combo descriptor')
7680
node.createwallet(wallet_name='w4', blank=True, descriptors=True)
7781
wallet = node.get_wallet_rpc('w4')

0 commit comments

Comments
 (0)