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

Rust bitcoin 0.32.4 #410

Merged
merged 2 commits into from
Nov 26, 2024
Merged
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
4 changes: 2 additions & 2 deletions Cargo-minimal.lock
Original file line number Diff line number Diff line change
@@ -217,9 +217,9 @@ dependencies = [

[[package]]
name = "bitcoin"
version = "0.32.2"
version = "0.32.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea507acc1cd80fc084ace38544bbcf7ced7c2aa65b653b102de0ce718df668f6"
checksum = "788902099d47c8682efe6a7afb01c8d58b9794ba66c06affd81c3d6b560743eb"
dependencies = [
"base58ck",
"base64 0.21.7",
4 changes: 2 additions & 2 deletions Cargo-recent.lock
Original file line number Diff line number Diff line change
@@ -217,9 +217,9 @@ dependencies = [

[[package]]
name = "bitcoin"
version = "0.32.2"
version = "0.32.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea507acc1cd80fc084ace38544bbcf7ced7c2aa65b653b102de0ce718df668f6"
checksum = "788902099d47c8682efe6a7afb01c8d58b9794ba66c06affd81c3d6b560743eb"
dependencies = [
"base58ck",
"base64 0.21.7",
2 changes: 1 addition & 1 deletion payjoin-directory/Cargo.toml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ danger-local-https = ["hyper-rustls", "rustls", "tokio-rustls"]

[dependencies]
anyhow = "1.0.71"
bitcoin = { version = "0.32.2", features = ["base64"] }
bitcoin = { version = "0.32.4", features = ["base64"] }
bhttp = { version = "=0.5.1", features = ["http"] }
futures = "0.3.17"
http-body-util = "0.1.2"
2 changes: 1 addition & 1 deletion payjoin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ io = ["reqwest/rustls-tls"]
danger-local-https = ["io", "reqwest/rustls-tls", "rustls"]

[dependencies]
bitcoin = { version = "0.32.2", features = ["base64"] }
bitcoin = { version = "0.32.4", features = ["base64"] }
bip21 = "0.5.0"
hpke = { package = "bitcoin-hpke", version = "0.13.0", optional = true }
log = { version = "0.4.14"}
13 changes: 2 additions & 11 deletions payjoin/src/psbt.rs
Original file line number Diff line number Diff line change
@@ -4,10 +4,9 @@ use std::collections::BTreeMap;
use std::fmt;

use bitcoin::address::FromScriptError;
use bitcoin::blockdata::script::Instruction;
use bitcoin::psbt::Psbt;
use bitcoin::transaction::InputWeightPrediction;
use bitcoin::{bip32, psbt, Address, AddressType, Network, Script, TxIn, TxOut, Weight};
use bitcoin::{bip32, psbt, Address, AddressType, Network, TxIn, TxOut, Weight};

#[derive(Debug)]
pub(crate) enum InconsistentPsbt {
@@ -93,14 +92,6 @@ impl PsbtExt for Psbt {
}
}

/// Gets redeemScript from the script_sig following BIP16 rules regarding P2SH spending.
fn redeem_script(script_sig: &Script) -> Option<&Script> {
match script_sig.instructions().last()?.ok()? {
Instruction::PushBytes(bytes) => Some(Script::from_bytes(bytes.as_bytes())),
Instruction::Op(_) => None,
}
}

// input script: 0x160014{20-byte-key-hash} = 23 bytes
// witness: <signature> <pubkey> = 72, 33 bytes
// https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#p2wpkh-nested-in-bip16-p2sh
@@ -202,7 +193,7 @@ impl InternalInputPair<'_> {
P2sh => {
// redeemScript can be extracted from scriptSig for signed P2SH inputs
let redeem_script = if let Some(ref script_sig) = self.psbtin.final_script_sig {
redeem_script(script_sig)
script_sig.redeem_script()
// try the PSBT redeem_script field for unsigned inputs.
} else {
self.psbtin.redeem_script.as_ref().map(|script| script.as_ref())