Skip to content

Commit 09ddfb2

Browse files
committed
Merge #2106: deps(bdk_chain)!: bump miniscript to 13.0.0
17d003a deps(bdk_chain)!: bump `miniscript` to `13.0.0` (Leonardo Lima) Pull request description: ### Description The PR upgrades `miniscript` to it's latest `v13.0.0`, it's a breaking change so it's only meant to being merged in master, can't be backported to `release/chain-0.23.x`. - upgrades `miniscript` version to `13.0.0`. - fixes the usage of `psbt.sign` in `example_cli. BREAKING_CHANGE: `bdk_chain` does re-exports the `miniscript` API, therefore bumping it's version is considered a breaking change. ### Notes to the reviewers ### Changelog notice ``` ### Changed - deps(bdk_chain): upgrades `miniscript` version to `13.0.0`. - chore(example_cli): fixes the usage of `psbt.sign` in `example_cli. ``` ### Checklists #### All Submissions: * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) #### New Features: * [x] I've added tests for the new feature * [x] I've added docs for the new feature ACKs for top commit: evanlinjin: ACK 17d003a ValuedMammal: ACK 17d003a Tree-SHA512: c9f37d197ffefb7439dfa9bfbcdedd71ecd188ebcbb096a918609ef6ae038c8c3ac38ceeadd751bfa3579c6b8cb0f4ee560f71eb5bf04afce6dee46d980b4e12
2 parents b4c8c6a + 17d003a commit 09ddfb2

File tree

3 files changed

+9
-24
lines changed

3 files changed

+9
-24
lines changed

.github/workflows/cont_integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- version: ${{ needs.prepare.outputs.rust_version }}
3030
- version: 1.85.0 # MSRV
3131
features:
32-
- --no-default-features --features miniscript/no-std,bdk_chain/hashbrown
32+
- --no-default-features --features bdk_chain/hashbrown
3333
- --all-features
3434
steps:
3535
- name: checkout
@@ -71,7 +71,7 @@ jobs:
7171
- name: Check bdk_chain
7272
working-directory: ./crates/chain
7373
# TODO "--target thumbv6m-none-eabi" should work but currently does not
74-
run: cargo check --no-default-features --features miniscript/no-std,hashbrown
74+
run: cargo check --no-default-features --features hashbrown
7575
- name: Check esplora
7676
working-directory: ./crates/esplora
7777
# TODO "--target thumbv6m-none-eabi" should work but currently does not

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 = { version = "13.0.0", 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: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use bdk_chain::keychain_txout::DEFAULT_LOOKAHEAD;
22
use serde_json::json;
33
use std::cmp;
4-
use std::collections::HashMap;
54
use std::env;
65
use std::fmt;
76
use std::str::FromStr;
@@ -11,11 +10,10 @@ use anyhow::bail;
1110
use anyhow::Context;
1211
use bdk_chain::bitcoin::{
1312
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,
13+
secp256k1::Secp256k1, transaction, Address, Amount, Network, NetworkKind, Psbt, Sequence,
14+
Transaction, TxIn, TxOut,
1615
};
1716
use bdk_chain::miniscript::{
18-
descriptor::{DescriptorSecretKey, SinglePubKey},
1917
plan::{Assets, Plan},
2018
psbt::PsbtExt,
2119
Descriptor, DescriptorPublicKey, ForEachKey,
@@ -690,27 +688,14 @@ pub fn handle_commands<CS: clap::Subcommand, S: clap::Args>(
690688

691689
let secp = Secp256k1::new();
692690
let (_, keymap) = Descriptor::parse_descriptor(&secp, &desc_str)?;
691+
693692
if keymap.is_empty() {
694693
bail!("unable to sign")
695694
}
696695

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

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

0 commit comments

Comments
 (0)