Merge rust-bitcoin/rust-bitcoin#2964: Remove nonsense method
dfce405007
Remove nonsense method (yancy) Pull request description: Weight type implicitly includes witness scale factor closes https://github.com/rust-bitcoin/rust-bitcoin/issues/2963 ACKs for top commit: Kixunil: ACKdfce405007
apoelstra: ACKdfce405007
agreed about CI, we are very close to removing it Tree-SHA512: 1c30c61863dd9c2ce5b6524931a21f99825edfd7401b833581194792c622030a4aa6b9c0f9680f97a8ae901604314805efa77e6fe1e8c15b356ddfea99ffe90c
This commit is contained in:
commit
5ca4d0e376
|
@ -122,13 +122,6 @@ impl Weight {
|
|||
///
|
||||
/// Computes `self / rhs` returning `None` if `rhs == 0`.
|
||||
pub fn checked_div(self, rhs: u64) -> Option<Self> { self.0.checked_div(rhs).map(Self) }
|
||||
|
||||
/// Scale by witness factor.
|
||||
///
|
||||
/// Computes `self * WITNESS_SCALE_FACTOR` returning `None` if an overflow occurred.
|
||||
pub fn scale_by_witness_factor(self) -> Option<Self> {
|
||||
Self::checked_mul(self, Self::WITNESS_SCALE_FACTOR)
|
||||
}
|
||||
}
|
||||
|
||||
/// Alternative will display the unit.
|
||||
|
@ -252,15 +245,6 @@ mod tests {
|
|||
let result = Weight(2).checked_div(0);
|
||||
assert_eq!(None, result);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scale_by_witness_factor() {
|
||||
let result = Weight(1).scale_by_witness_factor().expect("expected weight unit");
|
||||
assert_eq!(Weight(4), result);
|
||||
|
||||
let result = Weight::MAX.scale_by_witness_factor();
|
||||
assert_eq!(None, result);
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Weight> for u64 {
|
||||
|
|
Loading…
Reference in New Issue