Skip to content

Commit 5ae56d1

Browse files
committed
Update secp256k1 dependency to use PR rust-bitcoin/rust-secp256k1#721
1 parent 044fb7b commit 5ae56d1

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

bitcoin/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exclude = ["tests", "contrib"]
1616
[features]
1717
default = [ "std", "secp-recovery" ]
1818
std = ["base58/std", "bech32/std", "hashes/std", "hex/std", "internals/std", "io/std", "secp256k1/std", "units/std"]
19-
rand-std = ["secp256k1/rand-std", "std"]
19+
rand-std = ["secp256k1/std", "secp256k1/rand", "std"]
2020
rand = ["secp256k1/rand"]
2121
serde = ["actual-serde", "hashes/serde", "secp256k1/serde", "internals/serde", "units/serde"]
2222
secp-lowmemory = ["secp256k1/lowmemory"]
@@ -35,7 +35,7 @@ hex = { package = "hex-conservative", version = "0.2.0", default-features = fals
3535
hex_lit = "0.1.1"
3636
internals = { package = "bitcoin-internals", version = "0.3.0", features = ["alloc"] }
3737
io = { package = "bitcoin-io", version = "0.1.1", default-features = false, features = ["alloc"] }
38-
secp256k1 = { version = "0.29.0", default-features = false, features = ["hashes", "alloc"] }
38+
secp256k1 = { git = "https://github.com/rust-bitcoin/rust-secp256k1.git", rev = "refs/pull/721/head", default-features = false, features = ["alloc", "hashes", "rand", "std"] }
3939
units = { package = "bitcoin-units", version = "0.1.0", default-features = false, features = ["alloc"] }
4040

4141
base64 = { version = "0.21.3", optional = true }

bitcoin/src/psbt/mod.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ use crate::crypto::{ecdsa, taproot};
2828
use crate::key::{TapTweak, XOnlyPublicKey};
2929
use crate::prelude::*;
3030
use crate::sighash::{self, EcdsaSighashType, Prevouts, SighashCache};
31-
use crate::{Amount, FeeRate, TapLeafHash, TapSighashType};
31+
use crate::{Amount, FeeRate, TapLeafHash, TapSighash, TapSighashType};
32+
33+
use crate::hashes::Hash;
3234

3335
#[rustfmt::skip] // Keep public re-exports separate.
3436
#[doc(inline)]
@@ -444,6 +446,8 @@ impl Psbt {
444446
.tap_tweak(secp, input.tap_merkle_root)
445447
.to_inner();
446448

449+
let msg = msg.to_byte_array();
450+
447451
#[cfg(feature = "rand-std")]
448452
let signature = secp.sign_schnorr(&msg, &key_pair);
449453
#[cfg(not(feature = "rand-std"))]
@@ -471,6 +475,8 @@ impl Psbt {
471475
let (msg, sighash_type) =
472476
self.sighash_taproot(input_index, cache, Some(lh))?;
473477

478+
let msg = msg.to_byte_array();
479+
474480
#[cfg(feature = "rand-std")]
475481
let signature = secp.sign_schnorr(&msg, &key_pair);
476482
#[cfg(not(feature = "rand-std"))]
@@ -561,7 +567,7 @@ impl Psbt {
561567
input_index: usize,
562568
cache: &mut SighashCache<T>,
563569
leaf_hash: Option<TapLeafHash>,
564-
) -> Result<(Message, TapSighashType), SignError> {
570+
) -> Result<(TapSighash, TapSighashType), SignError> {
565571
use OutputType::*;
566572

567573
if self.signing_algorithm(input_index)? != SigningAlgorithm::Schnorr {
@@ -606,7 +612,7 @@ impl Psbt {
606612
} else {
607613
cache.taproot_key_spend_signature_hash(input_index, &prev_outs, hash_ty)?
608614
};
609-
Ok((Message::from(sighash), hash_ty))
615+
Ok((sighash, hash_ty))
610616
}
611617
_ => Err(SignError::Unsupported),
612618
}

0 commit comments

Comments
 (0)