Description
The wallet_name_from_descriptor function in src/wallet/mod.rs has a TODO comment: // TODO: check descriptors contains only public keys. This should prevent generating wallet names from descriptors containing private keys, ensuring names are derived from public information only.
Proposed Implementation
- After parsing the descriptor via into_wallet_descriptor, check if the returned KeyMap is empty.
- If !keymap.is_empty(), return DescriptorError::Miniscript(miniscript::Error::Unexpected("Descriptor must contain only public keys".to_string())).
- Apply the same check to the optional change_descriptor.
- This leverages the fact that KeyMap contains secret keys only when the descriptor string included private keys.
Description
The wallet_name_from_descriptor function in
src/wallet/mod.rshas a TODO comment: // TODO: check descriptors contains only public keys. This should prevent generating wallet names from descriptors containing private keys, ensuring names are derived from public information only.Proposed Implementation