Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client_rs: bump bitcoin 0.32 and miniscript 12.2 #278

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bitcoin_client_rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ledger_bitcoin_client"
version = "0.4.1"
version = "0.5.0"
authors = ["Edouard Paris <[email protected]>"]
edition = "2018"
description = "Ledger Bitcoin application client"
Expand All @@ -21,8 +21,8 @@ paranoid_client = ["miniscript"]

[dependencies]
async-trait = { version = "0.1", optional = true }
bitcoin = { version = "0.31", default-features = false, features = ["no-std"] }
miniscript = { version = "11.0", optional = true, default-features = false, features = ["no-std"] }
bitcoin = { version = "0.32", default-features = false }
miniscript = { version = "12.2", optional = true, default-features = false, features = ["no-std"] }

[workspace]
members = ["examples/ledger_hwi"]
Expand Down
2 changes: 1 addition & 1 deletion bitcoin_client_rs/examples/ledger_hwi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2018"
clap = { version = "4.0.18", features = ["derive"] }
ledger_bitcoin_client = { path = "../.." }
async-trait = { version = "0.1"}
bitcoin = { version = "0.31", default-features = false, features = ["no-std"] }
bitcoin = { version = "0.32", default-features = false }
hex = "0.4"
base64 = "0.13.0"
ledger-apdu = "0.10"
Expand Down
2 changes: 1 addition & 1 deletion bitcoin_client_rs/src/async_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl<T: Transport> BitcoinClient<T> {
BitcoinClientError::ClientError("Failed to derive descriptor".to_string())
})?
.script_pubkey()
!= expected_address.payload().script_pubkey()
!= expected_address.assume_checked_ref().script_pubkey()
{
return Err(BitcoinClientError::InvalidResponse("Invalid address. Please update your Bitcoin app. If the problem persists, report a bug at https://github.com/LedgerHQ/app-bitcoin-new".to_string()));
}
Expand Down
2 changes: 1 addition & 1 deletion bitcoin_client_rs/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl<T: Transport> BitcoinClient<T> {
BitcoinClientError::ClientError("Failed to derive descriptor".to_string())
})?
.script_pubkey()
!= expected_address.payload().script_pubkey()
!= expected_address.assume_checked_ref().script_pubkey()
{
return Err(BitcoinClientError::InvalidResponse("Invalid address. Please update your Bitcoin app. If the problem persists, report a bug at https://github.com/LedgerHQ/app-bitcoin-new".to_string()));
}
Expand Down
2 changes: 1 addition & 1 deletion bitcoin_client_rs/src/psbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bitcoin::{
consensus::encode::{deserialize, serialize, VarInt},
ecdsa,
hashes::Hash,
key::Error as KeyError,
key::FromSliceError as KeyError,
psbt::{raw, Input, Output, Psbt},
secp256k1::{self, XOnlyPublicKey},
taproot,
Expand Down
38 changes: 24 additions & 14 deletions bitcoin_client_rs/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,23 +258,33 @@ impl FromStr for WalletPubKey {

impl core::fmt::Display for WalletPubKey {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
if self.source.is_none() {
write!(f, "{}", self.inner)
} else {
write!(
match &self.source {
None => write!(
f,
"[{}{}]{}{}",
self.source.as_ref().unwrap().0,
self.source
.as_ref()
.unwrap()
.1
.to_string()
.strip_prefix('m')
.unwrap_or(""),
"{}{}",
self.inner,
self.multipath.as_ref().unwrap_or(&"".to_string())
)
),
Some((fg, path)) => {
if path.is_master() {
write!(
f,
"[{}]{}{}",
fg,
self.inner,
self.multipath.as_ref().unwrap_or(&"".to_string())
)
} else {
write!(
f,
"[{}/{}]{}{}",
fg,
path,
self.inner,
self.multipath.as_ref().unwrap_or(&"".to_string())
)
}
}
}
}
}
Expand Down
Loading