Skip to content

Commit

Permalink
wallet, rpc: listdescriptors does not need unlocked
Browse files Browse the repository at this point in the history
With the last hardened xpub cache, we don't neeed to have the wallet be
unlocked for listdescriptors.
  • Loading branch information
achow101 committed Jun 24, 2021
1 parent 3280704 commit e6cf0ed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/wallet/rpcdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1787,8 +1787,6 @@ RPCHelpMan listdescriptors()
throw JSONRPCError(RPC_WALLET_ERROR, "listdescriptors is not available for non-descriptor wallets");
}

EnsureWalletIsUnlocked(*wallet);

LOCK(wallet->cs_wallet);

UniValue descriptors(UniValue::VARR);
Expand Down
3 changes: 0 additions & 3 deletions src/wallet/scriptpubkeyman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2269,9 +2269,6 @@ const std::vector<CScript> DescriptorScriptPubKeyMan::GetScriptPubKeys() const
bool DescriptorScriptPubKeyMan::GetDescriptorString(std::string& out) const
{
LOCK(cs_desc_man);
if (m_storage.IsLocked()) {
return false;
}

FlatSigningProvider provider;
provider.keys = GetKeys();
Expand Down
4 changes: 4 additions & 0 deletions test/functional/wallet_listdescriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ def run_test(self):
}
assert_equal(expected, wallet.listdescriptors())

self.log.info("Test listdescriptors with encrypted wallet")
wallet.encryptwallet("pass")
assert_equal(expected, wallet.listdescriptors())

self.log.info('Test non-active non-range combo descriptor')
node.createwallet(wallet_name='w4', blank=True, descriptors=True)
wallet = node.get_wallet_rpc('w4')
Expand Down

0 comments on commit e6cf0ed

Please sign in to comment.