eacb1e7831 Deprecate function (yancy)

Pull request description:

  closes https://github.com/rust-bitcoin/rust-bitcoin/issues/3602

ACKs for top commit:
  tcharding:
    ACK eacb1e7831
  apoelstra:
    ACK eacb1e7831bdf2058a674a106b91447c1fe9470e; successfully ran local tests; lol

Tree-SHA512: 9da7881ee62e1808d83c92e232cef42055cce6e3ba03dc1001472948380c16a1968da1d4ce4f7ad13d78d1d70e143851f2635ba167c4df34be61ecf3f2fdee4e
This commit is contained in:
merge-script 2024-11-14 18:21:20 +00:00
commit 72760bbe96
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
2 changed files with 2 additions and 7 deletions

View File

@ -86,7 +86,7 @@ crate::internal_macros::define_extension_trait! {
/// Base weight excludes the witness and script. /// 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`. // We need to use this const here but do not want to make it public in `primitives::TxIn`.
const TX_IN_BASE_WEIGHT: Weight = 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! { crate::internal_macros::define_extension_trait! {
/// Extension functionality for the [`TxIn`] type. /// Extension functionality for the [`TxIn`] type.

View File

@ -68,6 +68,7 @@ impl Weight {
/// # Panics /// # Panics
/// ///
/// If the conversion from virtual bytes overflows. /// 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 { pub const fn from_vb_unwrap(vb: u64) -> Weight {
match vb.checked_mul(Self::WITNESS_SCALE_FACTOR) { match vb.checked_mul(Self::WITNESS_SCALE_FACTOR) {
Some(weight) => Weight(weight), Some(weight) => Weight(weight),
@ -272,12 +273,6 @@ mod tests {
assert_eq!(None, w); assert_eq!(None, w);
} }
#[test]
fn from_vb_const() {
const WU: Weight = Weight::from_vb_unwrap(1);
assert_eq!(Weight(4), WU);
}
#[test] #[test]
fn from_vb_unchecked() { fn from_vb_unchecked() {
let w = Weight::from_vb_unchecked(1); let w = Weight::from_vb_unchecked(1);