2025-01-26 automated rustfmt nightly
This commit is contained in:
parent
5504e062a9
commit
a3d2b2a93a
|
@ -112,10 +112,7 @@ fn bitcoin_genesis_tx(params: &Params) -> Transaction {
|
||||||
witness: Witness::default(),
|
witness: Witness::default(),
|
||||||
});
|
});
|
||||||
|
|
||||||
ret.output.push(TxOut {
|
ret.output.push(TxOut { value: Amount::FIFTY_BTC, script_pubkey: out_script });
|
||||||
value: Amount::FIFTY_BTC,
|
|
||||||
script_pubkey: out_script,
|
|
||||||
});
|
|
||||||
|
|
||||||
// end
|
// end
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -490,7 +490,6 @@ mod tests {
|
||||||
|
|
||||||
assert!(lock_time.is_satisfied_by(height, day_after));
|
assert!(lock_time.is_satisfied_by(height, day_after));
|
||||||
assert!(!lock_time.is_satisfied_by(height, day_before));
|
assert!(!lock_time.is_satisfied_by(height, day_before));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -22,10 +22,7 @@ fn sanity_check() {
|
||||||
let ssat = SignedAmount::from_sat;
|
let ssat = SignedAmount::from_sat;
|
||||||
|
|
||||||
assert_eq!(ssat(-100).abs(), ssat(100));
|
assert_eq!(ssat(-100).abs(), ssat(100));
|
||||||
assert_eq!(
|
assert_eq!(ssat(i64::MIN + 1).checked_abs().unwrap(), ssat(i64::MAX));
|
||||||
ssat(i64::MIN + 1).checked_abs().unwrap(),
|
|
||||||
ssat(i64::MAX)
|
|
||||||
);
|
|
||||||
assert_eq!(ssat(-100).signum(), -1);
|
assert_eq!(ssat(-100).signum(), -1);
|
||||||
assert_eq!(ssat(0).signum(), 0);
|
assert_eq!(ssat(0).signum(), 0);
|
||||||
assert_eq!(ssat(100).signum(), 1);
|
assert_eq!(ssat(100).signum(), 1);
|
||||||
|
@ -36,14 +33,8 @@ fn sanity_check() {
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
{
|
{
|
||||||
assert_eq!(
|
assert_eq!(Amount::from_float_in(0_f64, Denomination::Bitcoin).unwrap(), sat(0));
|
||||||
Amount::from_float_in(0_f64, Denomination::Bitcoin).unwrap(),
|
assert_eq!(Amount::from_float_in(2_f64, Denomination::Bitcoin).unwrap(), sat(200_000_000));
|
||||||
sat(0)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
Amount::from_float_in(2_f64, Denomination::Bitcoin).unwrap(),
|
|
||||||
sat(200_000_000)
|
|
||||||
);
|
|
||||||
assert!(Amount::from_float_in(-100_f64, Denomination::Bitcoin).is_err());
|
assert!(Amount::from_float_in(-100_f64, Denomination::Bitcoin).is_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,14 +176,8 @@ fn unchecked_arithmetic() {
|
||||||
let sat = Amount::from_sat;
|
let sat = Amount::from_sat;
|
||||||
let ssat = SignedAmount::from_sat;
|
let ssat = SignedAmount::from_sat;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(ssat(10).unchecked_add(ssat(20)), ssat(30));
|
||||||
ssat(10).unchecked_add(ssat(20)),
|
assert_eq!(ssat(50).unchecked_sub(ssat(10)), ssat(40));
|
||||||
ssat(30)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
ssat(50).unchecked_sub(ssat(10)),
|
|
||||||
ssat(40)
|
|
||||||
);
|
|
||||||
assert_eq!(sat(5).unchecked_add(sat(7)), sat(12));
|
assert_eq!(sat(5).unchecked_add(sat(7)), sat(12));
|
||||||
assert_eq!(sat(10).unchecked_sub(sat(7)), sat(3));
|
assert_eq!(sat(10).unchecked_sub(sat(7)), sat(3));
|
||||||
}
|
}
|
||||||
|
@ -201,10 +186,7 @@ fn unchecked_arithmetic() {
|
||||||
fn positive_sub() {
|
fn positive_sub() {
|
||||||
let ssat = SignedAmount::from_sat;
|
let ssat = SignedAmount::from_sat;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(ssat(10).positive_sub(ssat(7)).unwrap(), ssat(3));
|
||||||
ssat(10).positive_sub(ssat(7)).unwrap(),
|
|
||||||
ssat(3)
|
|
||||||
);
|
|
||||||
assert!(ssat(-10).positive_sub(ssat(7)).is_none());
|
assert!(ssat(-10).positive_sub(ssat(7)).is_none());
|
||||||
assert!(ssat(10).positive_sub(ssat(-7)).is_none());
|
assert!(ssat(10).positive_sub(ssat(-7)).is_none());
|
||||||
assert!(ssat(10).positive_sub(ssat(11)).is_none());
|
assert!(ssat(10).positive_sub(ssat(11)).is_none());
|
||||||
|
|
|
@ -188,9 +188,7 @@ impl ops::Div<FeeRate> for Amount {
|
||||||
/// This operation will panic if `fee_rate` is zero or the division results in overflow.
|
/// This operation will panic if `fee_rate` is zero or the division results in overflow.
|
||||||
///
|
///
|
||||||
/// Note: This uses floor division. For ceiling division use [`Amount::checked_div_by_fee_rate_ceil`].
|
/// Note: This uses floor division. For ceiling division use [`Amount::checked_div_by_fee_rate_ceil`].
|
||||||
fn div(self, rhs: FeeRate) -> Self::Output {
|
fn div(self, rhs: FeeRate) -> Self::Output { self.checked_div_by_fee_rate_floor(rhs).unwrap() }
|
||||||
self.checked_div_by_fee_rate_floor(rhs).unwrap()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Reference in New Issue