Skip to content

Commit 79fcadc

Browse files
committed
chore(deps): bump rust-miniscript to 0.12.x
1 parent c4966e5 commit 79fcadc

File tree

2 files changed

+9
-22
lines changed

2 files changed

+9
-22
lines changed

crates/chain/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ workspace = true
1919
bitcoin = { version = "0.32.0", default-features = false }
2020
bdk_core = { path = "../core", version = "0.6.2", default-features = false }
2121
serde = { version = "1", optional = true, features = ["derive", "rc"] }
22-
miniscript = { version = "12.3.1", optional = true, default-features = false }
22+
miniscript = { git = "https://github.com/rust-bitcoin/rust-miniscript.git", branch = "release-12.x", optional = true, default-features = false }
2323

2424
# Feature dependencies
2525
rusqlite = { version = "0.31.0", features = ["bundled"], optional = true }

examples/example_cli/src/lib.rs

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use bdk_chain::keychain_txout::DEFAULT_LOOKAHEAD;
2+
use bdk_chain::miniscript::descriptor::KeyMapWrapper;
23
use serde_json::json;
34
use std::cmp;
4-
use std::collections::HashMap;
55
use std::env;
66
use std::fmt;
77
use std::str::FromStr;
@@ -11,11 +11,10 @@ use anyhow::bail;
1111
use anyhow::Context;
1212
use bdk_chain::bitcoin::{
1313
absolute, address::NetworkUnchecked, bip32, consensus, constants, hex::DisplayHex, relative,
14-
secp256k1::Secp256k1, transaction, Address, Amount, Network, NetworkKind, PrivateKey, Psbt,
15-
PublicKey, Sequence, Transaction, TxIn, TxOut,
14+
secp256k1::Secp256k1, transaction, Address, Amount, Network, NetworkKind, Psbt, Sequence,
15+
Transaction, TxIn, TxOut,
1616
};
1717
use bdk_chain::miniscript::{
18-
descriptor::{DescriptorSecretKey, SinglePubKey},
1918
plan::{Assets, Plan},
2019
psbt::PsbtExt,
2120
Descriptor, DescriptorPublicKey, ForEachKey,
@@ -696,27 +695,15 @@ pub fn handle_commands<CS: clap::Subcommand, S: clap::Args>(
696695

697696
let secp = Secp256k1::new();
698697
let (_, keymap) = Descriptor::parse_descriptor(&secp, &desc_str)?;
698+
699699
if keymap.is_empty() {
700700
bail!("unable to sign")
701701
}
702702

703-
// note: we're only looking at the first entry in the keymap
704-
// the idea is to find something that impls `GetKey`
705-
let sign_res = match keymap.iter().next().expect("not empty") {
706-
(DescriptorPublicKey::Single(single_pub), DescriptorSecretKey::Single(prv)) => {
707-
let pk = match single_pub.key {
708-
SinglePubKey::FullKey(pk) => pk,
709-
SinglePubKey::XOnly(_) => unimplemented!("single xonly pubkey"),
710-
};
711-
let keys: HashMap<PublicKey, PrivateKey> = [(pk, prv.key)].into();
712-
psbt.sign(&keys, &secp)
713-
}
714-
(_, DescriptorSecretKey::XPrv(k)) => psbt.sign(&k.xkey, &secp),
715-
_ => unimplemented!("multi xkey signer"),
716-
};
717-
718-
let _ =
719-
sign_res.map_err(|errors| anyhow::anyhow!("failed to sign PSBT {errors:?}"))?;
703+
let keymap_wrapper: KeyMapWrapper = keymap.into();
704+
let _sign_res = psbt
705+
.sign(&keymap_wrapper, &secp)
706+
.map_err(|errors| anyhow::anyhow!("failed to sign PSBT {errors:?}"))?;
720707

721708
let mut obj = serde_json::Map::new();
722709
obj.insert("psbt".to_string(), json!(psbt.to_string()));

0 commit comments

Comments
 (0)