diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs index eefa9c0587..8bc36accb0 100644 --- a/bitcoin/src/blockdata/transaction.rs +++ b/bitcoin/src/blockdata/transaction.rs @@ -86,7 +86,7 @@ crate::internal_macros::define_extension_trait! { /// Base weight excludes the witness and script. // We need to use this const here but do not want to make it public in `primitives::TxIn`. const TX_IN_BASE_WEIGHT: Weight = - Weight::from_vb_unwrap(OutPoint::SIZE as u64 + Sequence::SIZE as u64); + Weight::from_vb_unchecked(OutPoint::SIZE as u64 + Sequence::SIZE as u64); crate::internal_macros::define_extension_trait! { /// Extension functionality for the [`TxIn`] type. diff --git a/units/src/weight.rs b/units/src/weight.rs index 7e1e0b7af5..7114e13c3f 100644 --- a/units/src/weight.rs +++ b/units/src/weight.rs @@ -68,6 +68,7 @@ impl Weight { /// # Panics /// /// If the conversion from virtual bytes overflows. + #[deprecated(since = "TBD", note = "use `from_vb_unchecked` instead")] pub const fn from_vb_unwrap(vb: u64) -> Weight { match vb.checked_mul(Self::WITNESS_SCALE_FACTOR) { Some(weight) => Weight(weight), @@ -272,12 +273,6 @@ mod tests { assert_eq!(None, w); } - #[test] - fn from_vb_const() { - const WU: Weight = Weight::from_vb_unwrap(1); - assert_eq!(Weight(4), WU); - } - #[test] fn from_vb_unchecked() { let w = Weight::from_vb_unchecked(1);