TLDR:
Currently, listdescriptors [private=true]
will fail for a non-watch-only wallet if any descriptor has a missing private key(e.g tr()
, multi()
, etc.). This PR changes that while making sure listdescriptors [private=true]
still fails if there no private keys. Closes #32078
In non-watch-only wallets, it’s possible to import descriptors as long as at least one private key is included. It’s important that users can still view these descriptors when they need to create a backup—even if some private keys are missing (#32078 (comment)). This change makes it possible to do so.
This change also helps prevent listdescriptors true
from failing completely, because one descriptor is missing some private keys.
Notes
- The new behaviour is applied to all descriptors including miniscript descriptors
listdescriptors true
still fails for watch-only wallets to preserve existing behaviour #24361 (review)- Wallet migration logic previously used
Descriptor::ToPrivateString()
to determine which descriptor was watchonly. This means that modifying theToPrivateString()
behaviour caused descriptors that were previously recognized as “watchonly” to be “non-watchonly”. In order to keep the scope of this PR limited to the RPC behaviour, this PR uses a different method to determinewatchonly
descriptors for the purpose of wallet migration. A follow-up PR can be opened to update migration logic to exclude descriptors with some private keys from thewatchonly
migration wallet.
Relevant PRs
Testing
Functional tests were added to test the new behaviour
EDIT
listdescriptors [private=true]
will still fail when there are no private keys because non-watchonly wallets must have private keys and calling listdescriptors [private=true]
for watchonly wallet returns an error