Skip to content

Implement Public Key Check in wallet_name_from_descriptor #481

@AmosOO7

Description

@AmosOO7

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions