From c4eb218cd0701e5d2713ae1791a90bf077b46392 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 15 Sep 2022 12:14:52 +1000 Subject: [PATCH 1/2] schnorr:: Remove incorrect deprecated Currently we attempt to have deprecated key types in the `schnorr` module. The `deprecated` attribute does not work on types, only on functions. Remove the broken deprecation logic and re-export key types instead of using type alias', this allows a bunch of qualified paths to be simplified also. Add `pub use` re-exports of all secp256k1 types that are part of the public API of the `schnorr` module. This makes the module more ergonomic to use. --- bitcoin/src/util/schnorr.rs | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/bitcoin/src/util/schnorr.rs b/bitcoin/src/util/schnorr.rs index 7036b6a2..13704790 100644 --- a/bitcoin/src/util/schnorr.rs +++ b/bitcoin/src/util/schnorr.rs @@ -11,29 +11,22 @@ use core::fmt; use bitcoin_internals::write_err; +pub use secp256k1::{self, constants, Secp256k1, KeyPair, XOnlyPublicKey, Verification}; + use crate::prelude::*; -use secp256k1::{self, Secp256k1, Verification, constants}; use crate::util::taproot::{TapBranchHash, TapTweakHash}; use crate::SchnorrSighashType; -/// Deprecated re-export of [`secp256k1::XOnlyPublicKey`] -#[deprecated(since = "0.28.0", note = "Please use `util::key::XOnlyPublicKey` instead")] -pub type XOnlyPublicKey = secp256k1::XOnlyPublicKey; - -/// Deprecated re-export of [`secp256k1::KeyPair`] -#[deprecated(since = "0.28.0", note = "Please use `util::key::KeyPair` instead")] -pub type KeyPair = secp256k1::KeyPair; - /// Untweaked BIP-340 X-coord-only public key -pub type UntweakedPublicKey = crate::XOnlyPublicKey; +pub type UntweakedPublicKey = XOnlyPublicKey; /// Tweaked BIP-340 X-coord-only public key #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", serde(crate = "actual_serde"))] #[cfg_attr(feature = "serde", serde(transparent))] -pub struct TweakedPublicKey(crate::XOnlyPublicKey); +pub struct TweakedPublicKey(XOnlyPublicKey); impl fmt::LowerHex for TweakedPublicKey { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -48,14 +41,14 @@ impl fmt::Display for TweakedPublicKey { } /// Untweaked BIP-340 key pair -pub type UntweakedKeyPair = crate::KeyPair; +pub type UntweakedKeyPair = KeyPair; /// Tweaked BIP-340 key pair #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", serde(crate = "actual_serde"))] #[cfg_attr(feature = "serde", serde(transparent))] -pub struct TweakedKeyPair(crate::KeyPair); +pub struct TweakedKeyPair(KeyPair); /// A trait for tweaking BIP340 key types (x-only public keys and key pairs). pub trait TapTweak { @@ -131,7 +124,7 @@ impl TapTweak for UntweakedKeyPair { /// # Returns /// The tweaked key and its parity. fn tap_tweak(self, secp: &Secp256k1, merkle_root: Option) -> TweakedKeyPair { - let (pubkey, _parity) = crate::XOnlyPublicKey::from_keypair(&self); + let (pubkey, _parity) = XOnlyPublicKey::from_keypair(&self); let tweak = TapTweakHash::from_key_and_tweak(pubkey, merkle_root).to_scalar(); let tweaked = self.add_xonly_tweak(secp, &tweak).expect("Tap tweak failed"); TweakedKeyPair(tweaked) @@ -149,12 +142,12 @@ impl TweakedPublicKey { /// This method is dangerous and can lead to loss of funds if used incorrectly. /// Specifically, in multi-party protocols a peer can provide a value that allows them to steal. #[inline] - pub fn dangerous_assume_tweaked(key: crate::XOnlyPublicKey) -> TweakedPublicKey { + pub fn dangerous_assume_tweaked(key: XOnlyPublicKey) -> TweakedPublicKey { TweakedPublicKey(key) } /// Returns the underlying public key. - pub fn to_inner(self) -> crate::XOnlyPublicKey { + pub fn to_inner(self) -> XOnlyPublicKey { self.0 } @@ -174,32 +167,32 @@ impl TweakedKeyPair { /// This method is dangerous and can lead to loss of funds if used incorrectly. /// Specifically, in multi-party protocols a peer can provide a value that allows them to steal. #[inline] - pub fn dangerous_assume_tweaked(pair: crate::KeyPair) -> TweakedKeyPair { + pub fn dangerous_assume_tweaked(pair: KeyPair) -> TweakedKeyPair { TweakedKeyPair(pair) } /// Returns the underlying key pair #[inline] #[deprecated(since = "0.29.0", note = "use to_inner instead")] - pub fn into_inner(self) -> crate::KeyPair { + pub fn into_inner(self) -> KeyPair { self.0 } /// Returns the underlying key pair. #[inline] - pub fn to_inner(self) -> crate::KeyPair { + pub fn to_inner(self) -> KeyPair { self.0 } } -impl From for crate::XOnlyPublicKey { +impl From for XOnlyPublicKey { #[inline] fn from(pair: TweakedPublicKey) -> Self { pair.0 } } -impl From for crate::KeyPair { +impl From for KeyPair { #[inline] fn from(pair: TweakedKeyPair) -> Self { pair.0 From 3f275f7f2b081eb805a94b44339145266a556364 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 15 Sep 2022 12:23:55 +1000 Subject: [PATCH 2/2] Remove code deprecated in v0.28.0 I believe we said we'd keep deprecated code around for two release cycles so this code can all be deleted now. --- bitcoin/src/blockdata/block.rs | 24 ---- bitcoin/src/blockdata/script.rs | 12 -- bitcoin/src/blockdata/transaction.rs | 42 ------ bitcoin/src/lib.rs | 2 - bitcoin/src/util/bip143.rs | 134 ------------------- bitcoin/src/util/bip32.rs | 6 - bitcoin/src/util/mod.rs | 1 - bitcoin/src/util/sighash.rs | 12 -- fuzz/fuzz_targets/deserialize_transaction.rs | 2 +- 9 files changed, 1 insertion(+), 234 deletions(-) delete mode 100644 bitcoin/src/util/bip143.rs diff --git a/bitcoin/src/blockdata/block.rs b/bitcoin/src/blockdata/block.rs index 8d4b75c7..2990ee86 100644 --- a/bitcoin/src/blockdata/block.rs +++ b/bitcoin/src/blockdata/block.rs @@ -298,12 +298,6 @@ impl Block { bitcoin_merkle_root(hashes).map(|h| h.into()) } - /// Calculate the transaction merkle root. - #[deprecated(since = "0.28.0", note = "Please use `block::compute_merkle_root` instead.")] - pub fn merkle_root(&self) -> Option { - self.compute_merkle_root() - } - /// Computes the witness commitment for the block's transaction list. pub fn compute_witness_commitment(witness_root: &WitnessMerkleNode, witness_reserved_value: &[u8]) -> WitnessCommitment { let mut encoder = WitnessCommitment::engine(); @@ -330,12 +324,6 @@ impl Block { 80 + VarInt(self.txdata.len() as u64).len() } - /// Returns the size of the block. - #[deprecated(since = "0.28.0", note = "Please use `block::size` instead.")] - pub fn get_size(&self) -> usize { - self.size() - } - /// Returns the size of the block. /// /// size == size of header + size of encoded transaction count + total size of transactions. @@ -344,24 +332,12 @@ impl Block { self.base_size() + txs_size } - /// Returns the strippedsize of the block. - #[deprecated(since = "0.28.0", note = "Please use `transaction::strippedsize` instead.")] - pub fn get_strippedsize(&self) -> usize { - self.strippedsize() - } - /// Returns the strippedsize of the block. pub fn strippedsize(&self) -> usize { let txs_size: usize = self.txdata.iter().map(Transaction::strippedsize).sum(); self.base_size() + txs_size } - /// Returns the weight of the block. - #[deprecated(since = "0.28.0", note = "Please use `transaction::weight` instead.")] - pub fn get_weight(&self) -> usize { - self.weight() - } - /// Returns the weight of the block. pub fn weight(&self) -> usize { let base_weight = WITNESS_SCALE_FACTOR * self.base_size(); diff --git a/bitcoin/src/blockdata/script.rs b/bitcoin/src/blockdata/script.rs index 11be7899..43cb6e83 100644 --- a/bitcoin/src/blockdata/script.rs +++ b/bitcoin/src/blockdata/script.rs @@ -382,23 +382,11 @@ impl Script { .into_script() } - /// Generates P2WPKH-type of scriptPubkey. - #[deprecated(since = "0.28.0", note = "use Script::new_v0_p2wpkh method instead")] - pub fn new_v0_wpkh(pubkey_hash: &WPubkeyHash) -> Script { - Script::new_v0_p2wpkh(pubkey_hash) - } - /// Generates P2WPKH-type of scriptPubkey. pub fn new_v0_p2wpkh(pubkey_hash: &WPubkeyHash) -> Script { Script::new_witness_program(WitnessVersion::V0, &pubkey_hash[..]) } - /// Generates P2WSH-type of scriptPubkey with a given hash of the redeem script. - #[deprecated(since = "0.28.0", note = "use Script::new_v0_p2wsh method instead")] - pub fn new_v0_wsh(script_hash: &WScriptHash) -> Script { - Script::new_v0_p2wsh(script_hash) - } - /// Generates P2WSH-type of scriptPubkey with a given hash of the redeem script. pub fn new_v0_p2wsh(script_hash: &WScriptHash) -> Script { Script::new_witness_program(WitnessVersion::V0, &script_hash[..]) diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs index 3b499df7..4cf61aea 100644 --- a/bitcoin/src/blockdata/transaction.rs +++ b/bitcoin/src/blockdata/transaction.rs @@ -712,13 +712,6 @@ impl Transaction { .expect("cache method doesn't error") } - /// Returns the "weight" of this transaction, as defined by BIP141. - #[inline] - #[deprecated(since = "0.28.0", note = "Please use `transaction::weight` instead.")] - pub fn get_weight(&self) -> usize { - self.weight() - } - /// Returns the "weight" of this transaction, as defined by BIP141. /// /// For transactions with an empty witness, this is simply the consensus-serialized size times @@ -729,26 +722,12 @@ impl Transaction { self.scaled_size(WITNESS_SCALE_FACTOR) } - /// Returns the regular byte-wise consensus-serialized size of this transaction. - #[inline] - #[deprecated(since = "0.28.0", note = "Please use `transaction::size` instead.")] - pub fn get_size(&self) -> usize { - self.size() - } - /// Returns the regular byte-wise consensus-serialized size of this transaction. #[inline] pub fn size(&self) -> usize { self.scaled_size(1) } - /// Returns the "virtual size" (vsize) of this transaction. - #[inline] - #[deprecated(since = "0.28.0", note = "Please use `transaction::vsize` instead.")] - pub fn get_vsize(&self) -> usize { - self.vsize() - } - /// Returns the "virtual size" (vsize) of this transaction. /// /// Will be `ceil(weight / 4.0)`. Note this implements the virtual size as per [`BIP141`], which @@ -764,12 +743,6 @@ impl Transaction { (weight + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR } - /// Returns the size of this transaction excluding the witness data. - #[deprecated(since = "0.28.0", note = "Please use `transaction::strippedsize` instead.")] - pub fn get_strippedsize(&self) -> usize { - self.strippedsize() - } - /// Returns the size of this transaction excluding the witness data. pub fn strippedsize(&self) -> usize { let mut input_size = 0; @@ -1017,10 +990,6 @@ impl Decodable for Transaction { } } -/// Legacy Hashtype of an input's signature -#[deprecated(since = "0.28.0", note = "Please use [`EcdsaSighashType`] instead")] -pub type SigHashType = EcdsaSighashType; - #[deprecated(since = "0.30.0", note = "use crate::NonStandardSighashType instead")] pub use crate::util::sighash::NonStandardSighashType; #[deprecated(since = "0.30.0", note = "use crate::EcdsaSighashType instead")] @@ -1043,7 +1012,6 @@ mod tests { use crate::hashes::hex::FromHex; use crate::hash_types::*; - use crate::util::sighash::NonStandardSighashType; const SOME_TX: &str = "0100000001a15d57094aa7a21a28cb20b59aab8fc7d1149a3bdbcddba9c622e4f5f6a99ece010000006c493046022100f93bb0e7d8db7bd46e40132d1f8242026e045f03a0efe71bbb8e3f475e970d790221009337cd7f1f929f00cc6ff01f03729b069a7c21b59b1736ddfee5db5946c5da8c0121033b9b137ee87d5a812d6f506efdd37f0affa7ffc310711c06c7f3e097c9447c52ffffffff0100e1f505000000001976a9140389035a9225b3839e2bbf32d826a1e222031fd888ac00000000"; @@ -1346,16 +1314,6 @@ mod tests { } } - #[test] - #[allow(deprecated)] - fn test_sighashtype_standard() { - let nonstandard_hashtype = 0x04; - // This type is not well defined, by consensus it becomes ALL - assert_eq!(EcdsaSighashType::from_u32_consensus(nonstandard_hashtype), EcdsaSighashType::All); - // But it's policy-invalid to use it! - assert_eq!(EcdsaSighashType::from_u32_standard(nonstandard_hashtype), Err(NonStandardSighashType(0x04))); - } - #[test] #[cfg(feature="bitcoinconsensus")] fn test_transaction_verify () { diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs index d9e1db32..8e320cf8 100644 --- a/bitcoin/src/lib.rs +++ b/bitcoin/src/lib.rs @@ -98,8 +98,6 @@ pub use crate::address::{Address, AddressType}; pub use crate::blockdata::block::{self, Block, BlockHeader, BlockVersion}; pub use crate::blockdata::locktime::{self, absolute, relative}; pub use crate::blockdata::script::{self, Script}; -#[allow(deprecated)] -pub use crate::blockdata::transaction::SigHashType; pub use crate::blockdata::transaction::{self, OutPoint, Sequence, Transaction, TxIn, TxOut}; pub use crate::blockdata::witness::{self, Witness}; pub use crate::blockdata::{constants, opcodes}; diff --git a/bitcoin/src/util/bip143.rs b/bitcoin/src/util/bip143.rs deleted file mode 100644 index 3ac2f7bd..00000000 --- a/bitcoin/src/util/bip143.rs +++ /dev/null @@ -1,134 +0,0 @@ -// Written in 2018 by Andrew Poelstra -// SPDX-License-Identifier: CC0-1.0 - -//! BIP143 implementation. -//! -//! Implementation of BIP143 Segwit-style signatures. Should be sufficient -//! to create signatures for Segwit transactions (which should be pushed into -//! the appropriate place in the `Transaction::witness` array) or bcash -//! signatures, which are placed in the scriptSig. -//! - -use core::ops::{Deref, DerefMut}; - -use crate::io; - -use crate::hashes::Hash; -use crate::hash_types::Sighash; -use crate::blockdata::script::Script; -use crate::blockdata::transaction::Transaction; -use crate::blockdata::witness::Witness; -use crate::consensus::encode; -use crate::util::sighash::{self, EcdsaSighashType}; - -/// A replacement for SigHashComponents which supports all sighash modes -#[deprecated(since = "0.28.0", note = "please use [sighash::SighashCache] instead")] -pub struct SigHashCache> { - cache: sighash::SighashCache, -} - -#[allow(deprecated)] -impl> SigHashCache { - /// Compute the sighash components from an unsigned transaction and auxiliary - /// in a lazy manner when required. - /// For the generated sighashes to be valid, no fields in the transaction may change except for - /// script_sig and witnesses. - pub fn new(tx: R) -> Self { - Self { cache: sighash::SighashCache::new(tx) } - } - - /// Encode the BIP143 signing data for any flag type into a given object implementing a - /// std::io::Write trait. - pub fn encode_signing_data_to( - &mut self, - writer: Write, - input_index: usize, - script_code: &Script, - value: u64, - sighash_type: EcdsaSighashType, - ) -> Result<(), encode::Error> { - self.cache - .segwit_encode_signing_data_to(writer, input_index, script_code, value, sighash_type) - .expect("input_index greater than tx input len"); - Ok(()) - } - - /// Compute the BIP143 sighash for any flag type. - pub fn signature_hash( - &mut self, - input_index: usize, - script_code: &Script, - value: u64, - sighash_type: EcdsaSighashType - ) -> Sighash { - let mut enc = Sighash::engine(); - self.encode_signing_data_to(&mut enc, input_index, script_code, value, sighash_type) - .expect("engines don't error"); - Sighash::from_engine(enc) - } -} - -#[allow(deprecated)] -impl> SigHashCache { - /// When the SigHashCache is initialized with a mutable reference to a transaction instead of a - /// regular reference, this method is available to allow modification to the witnesses. - /// - /// This allows in-line signing such as - /// - /// panics if `input_index` is out of bounds with respect of the number of inputs - /// - /// ``` - /// use bitcoin::util::bip143::SigHashCache; - /// use bitcoin::{absolute, EcdsaSighashType, Script, Transaction}; - /// - /// let mut tx_to_sign = Transaction { version: 2, lock_time: absolute::PackedLockTime::ZERO, input: Vec::new(), output: Vec::new() }; - /// let input_count = tx_to_sign.input.len(); - /// - /// let mut sig_hasher = SigHashCache::new(&mut tx_to_sign); - /// for inp in 0..input_count { - /// let prevout_script = Script::new(); - /// let _sighash = sig_hasher.signature_hash(inp, &prevout_script, 42, EcdsaSighashType::All); - /// // ... sign the sighash - /// sig_hasher.access_witness(inp).push(&[]); - /// } - /// ``` - pub fn access_witness(&mut self, input_index: usize) -> &mut Witness { - self.cache.witness_mut(input_index).unwrap() - } -} - -#[cfg(test)] -#[allow(deprecated)] -mod tests { - use crate::hash_types::Sighash; - use crate::blockdata::script::Script; - use crate::blockdata::transaction::Transaction; - use crate::consensus::encode::deserialize; - use crate::hashes::hex::FromHex; - use crate::util::sighash::SighashCache; - - use super::*; - - fn run_test_sighash_bip143(tx: &str, script: &str, input_index: usize, value: u64, hash_type: u32, expected_result: &str) { - let tx: Transaction = deserialize(&Vec::::from_hex(tx).unwrap()[..]).unwrap(); - let script = Script::from(Vec::::from_hex(script).unwrap()); - let raw_expected = Sighash::from_hex(expected_result).unwrap(); - let expected_result = Sighash::from_slice(&raw_expected[..]).unwrap(); - let mut cache = SighashCache::new(&tx); - let sighash_type = EcdsaSighashType::from_u32_consensus(hash_type); - let actual_result = cache.segwit_signature_hash(input_index, &script, value, sighash_type).unwrap(); - assert_eq!(actual_result, expected_result); - } - - #[test] - fn bip143_sighash_flags() { - // All examples generated via Bitcoin Core RPC using signrawtransactionwithwallet - // with additional debug printing - run_test_sighash_bip143("0200000001cf309ee0839b8aaa3fbc84f8bd32e9c6357e99b49bf6a3af90308c68e762f1d70100000000feffffff0288528c61000000001600146e8d9e07c543a309dcdeba8b50a14a991a658c5be0aebb0000000000160014698d8419804a5d5994704d47947889ff7620c004db000000", "76a91462744660c6b5133ddeaacbc57d2dc2d7b14d0b0688ac", 0, 1648888940, 0x01, "0a1bc2758dbb5b3a56646f8cafbf63f410cc62b77a482f8b87552683300a7711"); - run_test_sighash_bip143("0200000001cf309ee0839b8aaa3fbc84f8bd32e9c6357e99b49bf6a3af90308c68e762f1d70100000000feffffff0288528c61000000001600146e8d9e07c543a309dcdeba8b50a14a991a658c5be0aebb0000000000160014698d8419804a5d5994704d47947889ff7620c004db000000", "76a91462744660c6b5133ddeaacbc57d2dc2d7b14d0b0688ac", 0, 1648888940, 0x02, "3e275ac8b084f79f756dcd535bffb615cc94a685eefa244d9031eaf22e4cec12"); - run_test_sighash_bip143("0200000001cf309ee0839b8aaa3fbc84f8bd32e9c6357e99b49bf6a3af90308c68e762f1d70100000000feffffff0288528c61000000001600146e8d9e07c543a309dcdeba8b50a14a991a658c5be0aebb0000000000160014698d8419804a5d5994704d47947889ff7620c004db000000", "76a91462744660c6b5133ddeaacbc57d2dc2d7b14d0b0688ac", 0, 1648888940, 0x03, "191a08165ffacc3ea55753b225f323c35fd00d9cc0268081a4a501921fc6ec14"); - run_test_sighash_bip143("0200000001cf309ee0839b8aaa3fbc84f8bd32e9c6357e99b49bf6a3af90308c68e762f1d70100000000feffffff0288528c61000000001600146e8d9e07c543a309dcdeba8b50a14a991a658c5be0aebb0000000000160014698d8419804a5d5994704d47947889ff7620c004db000000", "76a91462744660c6b5133ddeaacbc57d2dc2d7b14d0b0688ac", 0, 1648888940, 0x81, "4b6b612530f94470bbbdef18f57f2990d56b239f41b8728b9a49dc8121de4559"); - run_test_sighash_bip143("0200000001cf309ee0839b8aaa3fbc84f8bd32e9c6357e99b49bf6a3af90308c68e762f1d70100000000feffffff0288528c61000000001600146e8d9e07c543a309dcdeba8b50a14a991a658c5be0aebb0000000000160014698d8419804a5d5994704d47947889ff7620c004db000000", "76a91462744660c6b5133ddeaacbc57d2dc2d7b14d0b0688ac", 0, 1648888940, 0x82, "a7e916d3acd4bb97a21e6793828279aeab02162adf8099ea4f309af81f3d5adb"); - run_test_sighash_bip143("0200000001cf309ee0839b8aaa3fbc84f8bd32e9c6357e99b49bf6a3af90308c68e762f1d70100000000feffffff0288528c61000000001600146e8d9e07c543a309dcdeba8b50a14a991a658c5be0aebb0000000000160014698d8419804a5d5994704d47947889ff7620c004db000000", "76a91462744660c6b5133ddeaacbc57d2dc2d7b14d0b0688ac", 0, 1648888940, 0x83, "d9276e2a48648ddb53a4aaa58314fc2b8067c13013e1913ffb67e0988ce82c78"); - } -} diff --git a/bitcoin/src/util/bip32.rs b/bitcoin/src/util/bip32.rs index a6d1a17c..e5e317b5 100644 --- a/bitcoin/src/util/bip32.rs +++ b/bitcoin/src/util/bip32.rs @@ -659,12 +659,6 @@ impl ExtendedPrivKey { } impl ExtendedPubKey { - /// Derives a public key from a private key - #[deprecated(since = "0.28.0", note = "use ExtendedPubKey::from_priv")] - pub fn from_private(secp: &Secp256k1, sk: &ExtendedPrivKey) -> ExtendedPubKey { - ExtendedPubKey::from_priv(secp, sk) - } - /// Derives a public key from a private key pub fn from_priv(secp: &Secp256k1, sk: &ExtendedPrivKey) -> ExtendedPubKey { ExtendedPubKey { diff --git a/bitcoin/src/util/mod.rs b/bitcoin/src/util/mod.rs index 72d66095..2ff777b7 100644 --- a/bitcoin/src/util/mod.rs +++ b/bitcoin/src/util/mod.rs @@ -12,7 +12,6 @@ pub mod schnorr; pub mod amount; pub mod base58; pub mod bip32; -pub mod bip143; pub mod bip152; pub mod hash; pub mod merkleblock; diff --git a/bitcoin/src/util/sighash.rs b/bitcoin/src/util/sighash.rs index ba09250c..706c0d95 100644 --- a/bitcoin/src/util/sighash.rs +++ b/bitcoin/src/util/sighash.rs @@ -363,12 +363,6 @@ impl EcdsaSighashType { } } - /// Creates a [`EcdsaSighashType`] from a raw `u32`. - #[deprecated(since="0.28.0", note="please use `from_consensus`")] - pub fn from_u32_consensus(n: u32) -> EcdsaSighashType { - EcdsaSighashType::from_consensus(n) - } - /// Creates a [`EcdsaSighashType`] from a raw `u32`. /// /// **Note**: this replicates consensus behaviour, for current standardness rules correctness @@ -398,12 +392,6 @@ impl EcdsaSighashType { } } - /// Creates a [`EcdsaSighashType`] from a raw `u32`. - #[deprecated(since="0.28.0", note="please use `from_standard`")] - pub fn from_u32_standard(n: u32) -> Result { - EcdsaSighashType::from_standard(n) - } - /// Creates a [`EcdsaSighashType`] from a raw `u32`. /// /// # Errors diff --git a/fuzz/fuzz_targets/deserialize_transaction.rs b/fuzz/fuzz_targets/deserialize_transaction.rs index ca7b2de2..05489d82 100644 --- a/fuzz/fuzz_targets/deserialize_transaction.rs +++ b/fuzz/fuzz_targets/deserialize_transaction.rs @@ -8,7 +8,7 @@ fn do_test(data: &[u8]) { let ser = bitcoin::consensus::encode::serialize(&tx); assert_eq!(&ser[..], data); let len = ser.len(); - let calculated_weight = tx.get_weight(); + let calculated_weight = tx.weight(); for input in &mut tx.input { input.witness = bitcoin::blockdata::witness::Witness::default(); }