Skip to content

Commit

Permalink
fix(wallet): do check_wallet_descriptor when creating and loading
Browse files Browse the repository at this point in the history
  • Loading branch information
ValuedMammal committed Sep 9, 2024
1 parent 257c5f7 commit 5aecf4d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/wallet/src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ impl Wallet {
let (chain, chain_changeset) = LocalChain::from_genesis_hash(genesis_hash);

let (descriptor, mut descriptor_keymap) = (params.descriptor)(&secp, network)?;
check_wallet_descriptor(&descriptor)?;
descriptor_keymap.extend(params.descriptor_keymap);

let signers = Arc::new(SignersContainer::build(
Expand All @@ -401,6 +402,7 @@ impl Wallet {
let (change_descriptor, change_signers) = match params.change_descriptor {
Some(make_desc) => {
let (change_descriptor, mut internal_keymap) = make_desc(&secp, network)?;
check_wallet_descriptor(&change_descriptor)?;
internal_keymap.extend(params.change_descriptor_keymap);
let change_signers = Arc::new(SignersContainer::build(
internal_keymap,
Expand Down Expand Up @@ -582,6 +584,7 @@ impl Wallet {
}
// parameters must match
Some(make_desc) => {
check_wallet_descriptor(&desc).map_err(LoadError::Descriptor)?;
let (exp_desc, keymap) =
make_desc(&secp, network).map_err(LoadError::Descriptor)?;
if desc.descriptor_id() != exp_desc.descriptor_id() {
Expand Down

0 comments on commit 5aecf4d

Please sign in to comment.