Upgrade secp dependency
Upgrade `rust-secp256k1` to the latest version `v0.29.0`. This removes the duplicate deps as well.
This commit is contained in:
parent
69716f17b9
commit
e1869340be
|
@ -18,9 +18,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
||||||
name = "base58ck"
|
name = "base58ck"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitcoin-internals 0.3.0",
|
"bitcoin-internals",
|
||||||
"bitcoin_hashes 0.14.0",
|
"bitcoin_hashes",
|
||||||
"hex-conservative 0.2.0",
|
"hex-conservative",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -53,12 +53,12 @@ dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bech32",
|
"bech32",
|
||||||
"bincode",
|
"bincode",
|
||||||
"bitcoin-internals 0.3.0",
|
"bitcoin-internals",
|
||||||
"bitcoin-io",
|
"bitcoin-io",
|
||||||
"bitcoin-units",
|
"bitcoin-units",
|
||||||
"bitcoin_hashes 0.14.0",
|
"bitcoin_hashes",
|
||||||
"bitcoinconsensus",
|
"bitcoinconsensus",
|
||||||
"hex-conservative 0.2.0",
|
"hex-conservative",
|
||||||
"hex_lit",
|
"hex_lit",
|
||||||
"mutagen",
|
"mutagen",
|
||||||
"ordered",
|
"ordered",
|
||||||
|
@ -79,12 +79,6 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bitcoin-internals"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitcoin-internals"
|
name = "bitcoin-internals"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
@ -100,28 +94,18 @@ version = "0.1.2"
|
||||||
name = "bitcoin-units"
|
name = "bitcoin-units"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitcoin-internals 0.3.0",
|
"bitcoin-internals",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_test",
|
"serde_test",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bitcoin_hashes"
|
|
||||||
version = "0.13.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b"
|
|
||||||
dependencies = [
|
|
||||||
"bitcoin-internals 0.2.0",
|
|
||||||
"hex-conservative 0.1.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitcoin_hashes"
|
name = "bitcoin_hashes"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitcoin-io",
|
"bitcoin-io",
|
||||||
"hex-conservative 0.2.0",
|
"hex-conservative",
|
||||||
"schemars",
|
"schemars",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -178,12 +162,6 @@ version = "1.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3"
|
checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hex-conservative"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hex-conservative"
|
name = "hex-conservative"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -374,11 +352,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "secp256k1"
|
name = "secp256k1"
|
||||||
version = "0.28.0"
|
version = "0.29.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2acea373acb8c21ecb5a23741452acd2593ed44ee3d343e72baaa143bc89d0d5"
|
checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitcoin_hashes 0.13.0",
|
"bitcoin_hashes",
|
||||||
"rand",
|
"rand",
|
||||||
"secp256k1-sys",
|
"secp256k1-sys",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -386,9 +364,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "secp256k1-sys"
|
name = "secp256k1-sys"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09e67c467c38fd24bd5499dc9a18183b31575c12ee549197e3e20d57aa4fe3b7"
|
checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
|
@ -18,9 +18,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
|
||||||
name = "base58ck"
|
name = "base58ck"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitcoin-internals 0.3.0",
|
"bitcoin-internals",
|
||||||
"bitcoin_hashes 0.14.0",
|
"bitcoin_hashes",
|
||||||
"hex-conservative 0.2.0",
|
"hex-conservative",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -52,12 +52,12 @@ dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bech32",
|
"bech32",
|
||||||
"bincode",
|
"bincode",
|
||||||
"bitcoin-internals 0.3.0",
|
"bitcoin-internals",
|
||||||
"bitcoin-io",
|
"bitcoin-io",
|
||||||
"bitcoin-units",
|
"bitcoin-units",
|
||||||
"bitcoin_hashes 0.14.0",
|
"bitcoin_hashes",
|
||||||
"bitcoinconsensus",
|
"bitcoinconsensus",
|
||||||
"hex-conservative 0.2.0",
|
"hex-conservative",
|
||||||
"hex_lit",
|
"hex_lit",
|
||||||
"mutagen",
|
"mutagen",
|
||||||
"ordered",
|
"ordered",
|
||||||
|
@ -78,12 +78,6 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bitcoin-internals"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitcoin-internals"
|
name = "bitcoin-internals"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
@ -99,28 +93,18 @@ version = "0.1.2"
|
||||||
name = "bitcoin-units"
|
name = "bitcoin-units"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitcoin-internals 0.3.0",
|
"bitcoin-internals",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_test",
|
"serde_test",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bitcoin_hashes"
|
|
||||||
version = "0.13.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b"
|
|
||||||
dependencies = [
|
|
||||||
"bitcoin-internals 0.2.0",
|
|
||||||
"hex-conservative 0.1.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitcoin_hashes"
|
name = "bitcoin_hashes"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitcoin-io",
|
"bitcoin-io",
|
||||||
"hex-conservative 0.2.0",
|
"hex-conservative",
|
||||||
"schemars",
|
"schemars",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -177,12 +161,6 @@ version = "1.7.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3"
|
checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hex-conservative"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hex-conservative"
|
name = "hex-conservative"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -363,11 +341,11 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "secp256k1"
|
name = "secp256k1"
|
||||||
version = "0.28.0"
|
version = "0.29.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2acea373acb8c21ecb5a23741452acd2593ed44ee3d343e72baaa143bc89d0d5"
|
checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitcoin_hashes 0.13.0",
|
"bitcoin_hashes",
|
||||||
"rand",
|
"rand",
|
||||||
"secp256k1-sys",
|
"secp256k1-sys",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -375,9 +353,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "secp256k1-sys"
|
name = "secp256k1-sys"
|
||||||
version = "0.9.0"
|
version = "0.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09e67c467c38fd24bd5499dc9a18183b31575c12ee549197e3e20d57aa4fe3b7"
|
checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
|
@ -35,7 +35,7 @@ hex = { package = "hex-conservative", version = "0.2.0", default-features = fals
|
||||||
hex_lit = "0.1.1"
|
hex_lit = "0.1.1"
|
||||||
internals = { package = "bitcoin-internals", version = "0.3.0" }
|
internals = { package = "bitcoin-internals", version = "0.3.0" }
|
||||||
io = { package = "bitcoin-io", version = "0.1.1", default-features = false, features = ["alloc"] }
|
io = { package = "bitcoin-io", version = "0.1.1", default-features = false, features = ["alloc"] }
|
||||||
secp256k1 = { version = "0.28.0", default-features = false, features = ["hashes", "alloc"] }
|
secp256k1 = { version = "0.29.0", default-features = false, features = ["hashes", "alloc"] }
|
||||||
units = { package = "bitcoin-units", version = "0.1.0", default-features = false, features = ["alloc"] }
|
units = { package = "bitcoin-units", version = "0.1.0", default-features = false, features = ["alloc"] }
|
||||||
|
|
||||||
base64 = { version = "0.21.3", optional = true }
|
base64 = { version = "0.21.3", optional = true }
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
use bitcoin::hashes::Hash;
|
|
||||||
use bitcoin::{
|
use bitcoin::{
|
||||||
consensus, ecdsa, sighash, Amount, CompressedPublicKey, Script, ScriptBuf, Transaction,
|
consensus, ecdsa, sighash, Amount, CompressedPublicKey, Script, ScriptBuf, Transaction,
|
||||||
};
|
};
|
||||||
|
@ -45,7 +44,7 @@ fn compute_sighash_p2wpkh(raw_tx: &[u8], inp_idx: usize, value: u64) {
|
||||||
.p2wpkh_signature_hash(inp_idx, &spk, Amount::from_sat(value), sig.sighash_type)
|
.p2wpkh_signature_hash(inp_idx, &spk, Amount::from_sat(value), sig.sighash_type)
|
||||||
.expect("failed to compute sighash");
|
.expect("failed to compute sighash");
|
||||||
println!("Segwit p2wpkh sighash: {:x}", sighash);
|
println!("Segwit p2wpkh sighash: {:x}", sighash);
|
||||||
let msg = secp256k1::Message::from_digest(sighash.to_byte_array());
|
let msg = secp256k1::Message::from(sighash);
|
||||||
println!("Message is {:x}", msg);
|
println!("Message is {:x}", msg);
|
||||||
let secp = secp256k1::Secp256k1::verification_only();
|
let secp = secp256k1::Secp256k1::verification_only();
|
||||||
pk.verify(&secp, &msg, &sig).unwrap()
|
pk.verify(&secp, &msg, &sig).unwrap()
|
||||||
|
|
|
@ -71,7 +71,7 @@ fn main() {
|
||||||
|
|
||||||
// Sign the sighash using the secp256k1 library (exported by rust-bitcoin).
|
// Sign the sighash using the secp256k1 library (exported by rust-bitcoin).
|
||||||
let tweaked: TweakedKeypair = keypair.tap_tweak(&secp, None);
|
let tweaked: TweakedKeypair = keypair.tap_tweak(&secp, None);
|
||||||
let msg = Message::from_digest(sighash.to_byte_array());
|
let msg = Message::from(sighash);
|
||||||
let signature = secp.sign_schnorr(&msg, &tweaked.to_inner());
|
let signature = secp.sign_schnorr(&msg, &tweaked.to_inner());
|
||||||
|
|
||||||
// Update the witness stack.
|
// Update the witness stack.
|
||||||
|
|
|
@ -80,7 +80,6 @@ use std::str::FromStr;
|
||||||
|
|
||||||
use bitcoin::bip32::{ChildNumber, DerivationPath, Fingerprint, Xpriv, Xpub};
|
use bitcoin::bip32::{ChildNumber, DerivationPath, Fingerprint, Xpriv, Xpub};
|
||||||
use bitcoin::consensus::encode;
|
use bitcoin::consensus::encode;
|
||||||
use bitcoin::hashes::Hash;
|
|
||||||
use bitcoin::key::{TapTweak, XOnlyPublicKey};
|
use bitcoin::key::{TapTweak, XOnlyPublicKey};
|
||||||
use bitcoin::opcodes::all::{OP_CHECKSIG, OP_CLTV, OP_DROP};
|
use bitcoin::opcodes::all::{OP_CHECKSIG, OP_CLTV, OP_DROP};
|
||||||
use bitcoin::psbt::{self, Input, Output, Psbt, PsbtSighashType};
|
use bitcoin::psbt::{self, Input, Output, Psbt, PsbtSighashType};
|
||||||
|
@ -739,7 +738,7 @@ fn sign_psbt_taproot(
|
||||||
Some(_) => keypair, // no tweak for script spend
|
Some(_) => keypair, // no tweak for script spend
|
||||||
};
|
};
|
||||||
|
|
||||||
let msg = secp256k1::Message::from_digest(hash.to_byte_array());
|
let msg = secp256k1::Message::from(hash);
|
||||||
let signature = secp.sign_schnorr(&msg, &keypair);
|
let signature = secp.sign_schnorr(&msg, &keypair);
|
||||||
|
|
||||||
let final_signature = taproot::Signature { signature, sighash_type };
|
let final_signature = taproot::Signature { signature, sighash_type };
|
||||||
|
|
|
@ -32,10 +32,12 @@ pub(crate) const UINT256_ONE: [u8; 32] = [
|
||||||
0, 0, 0, 0, 0, 0, 0, 0
|
0, 0, 0, 0, 0, 0, 0, 0
|
||||||
];
|
];
|
||||||
|
|
||||||
macro_rules! impl_thirty_two_byte_hash {
|
macro_rules! impl_message_from_hash {
|
||||||
($ty:ident) => {
|
($ty:ident) => {
|
||||||
impl secp256k1::ThirtyTwoByteHash for $ty {
|
impl From<$ty> for secp256k1::Message {
|
||||||
fn into_32(self) -> [u8; 32] { self.to_byte_array() }
|
fn from(hash: $ty) -> secp256k1::Message {
|
||||||
|
secp256k1::Message::from_digest(hash.to_byte_array())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -50,8 +52,8 @@ hash_newtype! {
|
||||||
pub struct SegwitV0Sighash(sha256d::Hash);
|
pub struct SegwitV0Sighash(sha256d::Hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_thirty_two_byte_hash!(LegacySighash);
|
impl_message_from_hash!(LegacySighash);
|
||||||
impl_thirty_two_byte_hash!(SegwitV0Sighash);
|
impl_message_from_hash!(SegwitV0Sighash);
|
||||||
|
|
||||||
sha256t_hash_newtype! {
|
sha256t_hash_newtype! {
|
||||||
pub struct TapSighashTag = hash_str("TapSighash");
|
pub struct TapSighashTag = hash_str("TapSighash");
|
||||||
|
@ -63,7 +65,7 @@ sha256t_hash_newtype! {
|
||||||
pub struct TapSighash(_);
|
pub struct TapSighash(_);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_thirty_two_byte_hash!(TapSighash);
|
impl_message_from_hash!(TapSighash);
|
||||||
|
|
||||||
/// Efficiently calculates signature hash message for legacy, segwit and taproot inputs.
|
/// Efficiently calculates signature hash message for legacy, segwit and taproot inputs.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -1935,7 +1937,7 @@ mod tests {
|
||||||
.taproot_signature_hash(tx_ind, &Prevouts::All(&utxos), None, None, hash_ty)
|
.taproot_signature_hash(tx_ind, &Prevouts::All(&utxos), None, None, hash_ty)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let msg = secp256k1::Message::from_digest(sighash.to_byte_array());
|
let msg = secp256k1::Message::from(sighash);
|
||||||
let key_spend_sig = secp.sign_schnorr_with_aux_rand(&msg, &tweaked_keypair, &[0u8; 32]);
|
let key_spend_sig = secp.sign_schnorr_with_aux_rand(&msg, &tweaked_keypair, &[0u8; 32]);
|
||||||
|
|
||||||
assert_eq!(expected.internal_pubkey, internal_key);
|
assert_eq!(expected.internal_pubkey, internal_key);
|
||||||
|
|
|
@ -18,7 +18,6 @@ use core::{cmp, fmt};
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
|
|
||||||
use hashes::Hash;
|
|
||||||
use internals::write_err;
|
use internals::write_err;
|
||||||
use secp256k1::{Keypair, Message, Secp256k1, Signing, Verification};
|
use secp256k1::{Keypair, Message, Secp256k1, Signing, Verification};
|
||||||
|
|
||||||
|
@ -523,7 +522,7 @@ impl Psbt {
|
||||||
let sighash = cache
|
let sighash = cache
|
||||||
.legacy_signature_hash(input_index, spk, hash_ty.to_u32())
|
.legacy_signature_hash(input_index, spk, hash_ty.to_u32())
|
||||||
.expect("input checked above");
|
.expect("input checked above");
|
||||||
Ok((Message::from_digest(sighash.to_byte_array()), hash_ty))
|
Ok((Message::from(sighash), hash_ty))
|
||||||
}
|
}
|
||||||
Sh => {
|
Sh => {
|
||||||
let script_code =
|
let script_code =
|
||||||
|
@ -531,17 +530,17 @@ impl Psbt {
|
||||||
let sighash = cache
|
let sighash = cache
|
||||||
.legacy_signature_hash(input_index, script_code, hash_ty.to_u32())
|
.legacy_signature_hash(input_index, script_code, hash_ty.to_u32())
|
||||||
.expect("input checked above");
|
.expect("input checked above");
|
||||||
Ok((Message::from_digest(sighash.to_byte_array()), hash_ty))
|
Ok((Message::from(sighash), hash_ty))
|
||||||
}
|
}
|
||||||
Wpkh => {
|
Wpkh => {
|
||||||
let sighash = cache.p2wpkh_signature_hash(input_index, spk, utxo.value, hash_ty)?;
|
let sighash = cache.p2wpkh_signature_hash(input_index, spk, utxo.value, hash_ty)?;
|
||||||
Ok((Message::from_digest(sighash.to_byte_array()), hash_ty))
|
Ok((Message::from(sighash), hash_ty))
|
||||||
}
|
}
|
||||||
ShWpkh => {
|
ShWpkh => {
|
||||||
let redeem_script = input.redeem_script.as_ref().expect("checked above");
|
let redeem_script = input.redeem_script.as_ref().expect("checked above");
|
||||||
let sighash =
|
let sighash =
|
||||||
cache.p2wpkh_signature_hash(input_index, redeem_script, utxo.value, hash_ty)?;
|
cache.p2wpkh_signature_hash(input_index, redeem_script, utxo.value, hash_ty)?;
|
||||||
Ok((Message::from_digest(sighash.to_byte_array()), hash_ty))
|
Ok((Message::from(sighash), hash_ty))
|
||||||
}
|
}
|
||||||
Wsh | ShWsh => {
|
Wsh | ShWsh => {
|
||||||
let witness_script =
|
let witness_script =
|
||||||
|
@ -549,7 +548,7 @@ impl Psbt {
|
||||||
let sighash = cache
|
let sighash = cache
|
||||||
.p2wsh_signature_hash(input_index, witness_script, utxo.value, hash_ty)
|
.p2wsh_signature_hash(input_index, witness_script, utxo.value, hash_ty)
|
||||||
.map_err(SignError::SegwitV0Sighash)?;
|
.map_err(SignError::SegwitV0Sighash)?;
|
||||||
Ok((Message::from_digest(sighash.to_byte_array()), hash_ty))
|
Ok((Message::from(sighash), hash_ty))
|
||||||
}
|
}
|
||||||
Tr => {
|
Tr => {
|
||||||
// This PSBT signing API is WIP, taproot to come shortly.
|
// This PSBT signing API is WIP, taproot to come shortly.
|
||||||
|
@ -1199,7 +1198,7 @@ pub use self::display_from_str::PsbtParseError;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use hashes::{hash160, ripemd160, sha256};
|
use hashes::{hash160, ripemd160, sha256, Hash};
|
||||||
use hex::{test_hex_unwrap as hex, FromHex};
|
use hex::{test_hex_unwrap as hex, FromHex};
|
||||||
#[cfg(feature = "rand-std")]
|
#[cfg(feature = "rand-std")]
|
||||||
use secp256k1::{All, SecretKey};
|
use secp256k1::{All, SecretKey};
|
||||||
|
|
|
@ -177,9 +177,6 @@ do_dup_deps() {
|
||||||
cargo tree --target=all --all-features --duplicates \
|
cargo tree --target=all --all-features --duplicates \
|
||||||
| grep '^[0-9A-Za-z]' \
|
| grep '^[0-9A-Za-z]' \
|
||||||
| grep -v 'syn' \
|
| grep -v 'syn' \
|
||||||
| grep -v 'bitcoin_hashes' \
|
|
||||||
| grep -v 'bitcoin-internals' \
|
|
||||||
| grep -v 'hex-conservative' \
|
|
||||||
| wc -l
|
| wc -l
|
||||||
)
|
)
|
||||||
if [ "$duplicate_dependencies" -ne 0 ]; then
|
if [ "$duplicate_dependencies" -ne 0 ]; then
|
||||||
|
|
Loading…
Reference in New Issue