Upgrade miniscript/bitcoin dependency

Upgrade:

- bitcoin to v0.31.0
- miniscript to v11.0.0

Note: The bitcoin upgrade includes improvements to the
`Transaction::weight()` function, it appears those guys did good, we
no longer need to add the 2 additional weight units "just in case".
This commit is contained in:
Tobin C. Harding
2023-10-16 19:51:53 +11:00
parent 53791eb6c5
commit 984c758f96
49 changed files with 556 additions and 519 deletions

View File

@@ -17,14 +17,13 @@
use bdk_chain::{bitcoin, collections::*, miniscript};
use bitcoin::{
absolute,
address::WitnessVersion,
bip32::{DerivationPath, Fingerprint, KeySource},
blockdata::transaction::Sequence,
ecdsa,
hashes::{hash160, ripemd160, sha256},
secp256k1::Secp256k1,
taproot::{self, LeafVersion, TapLeafHash},
ScriptBuf, TxIn, Witness,
ScriptBuf, TxIn, Witness, WitnessVersion,
};
use miniscript::{
descriptor::{InnerXKey, Tr},
@@ -32,7 +31,7 @@ use miniscript::{
};
pub(crate) fn varint_len(v: usize) -> usize {
bitcoin::VarInt(v as u64).len() as usize
bitcoin::VarInt(v as u64).size() as usize
}
mod plan_impls;

View File

@@ -3,12 +3,11 @@ use core::ops::Deref;
use bitcoin::{
bip32,
hashes::{hash160, ripemd160, sha256},
hashes::{hash160, ripemd160, sha256, Hash},
key::XOnlyPublicKey,
psbt::Prevouts,
secp256k1::{KeyPair, Message, PublicKey, Signing, Verification},
secp256k1::{Keypair, Message, PublicKey, Signing, Verification},
sighash,
sighash::{EcdsaSighashType, SighashCache, TapSighashType},
sighash::{EcdsaSighashType, Prevouts, SighashCache, TapSighashType},
taproot, Transaction, TxOut,
};
@@ -163,11 +162,11 @@ impl RequiredSignatures<DescriptorPublicKey> {
let tweak =
taproot::TapTweakHash::from_key_and_tweak(x_only_pubkey, merkle_root.clone());
let keypair = KeyPair::from_secret_key(&secp, &secret_key.clone())
let keypair = Keypair::from_secret_key(&secp, &secret_key.clone())
.add_xonly_tweak(&secp, &tweak.to_scalar())
.unwrap();
let msg = Message::from_slice(sighash.as_ref()).expect("Sighashes are 32 bytes");
let msg = Message::from_digest(sighash.to_byte_array());
let sig = secp.sign_schnorr_no_aux_rand(&msg, &keypair);
let bitcoin_sig = taproot::Signature {
@@ -209,9 +208,8 @@ impl RequiredSignatures<DescriptorPublicKey> {
todo!();
}
};
let keypair = KeyPair::from_secret_key(&secp, &secret_key.clone());
let msg =
Message::from_slice(sighash.as_ref()).expect("Sighashes are 32 bytes");
let keypair = Keypair::from_secret_key(&secp, &secret_key.clone());
let msg = Message::from_digest(sighash.to_byte_array());
let sig = secp.sign_schnorr_no_aux_rand(&msg, &keypair);
let bitcoin_sig = taproot::Signature {
sig,