Merge rust-bitcoin/rust-bitcoin#3422: Automated nightly rustfmt (2024-09-29)
a65d2a0ee4
2024-09-29 automated rustfmt nightly (Fmt Bot) Pull request description: Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action ACKs for top commit: apoelstra: ACKa65d2a0ee4
successfully ran local tests Tree-SHA512: 0c2dae3507adeaae39a9c0a377aa002fd303109229ed05d9dc13fcf36584b94f83adc5101c81360fac24b5ffc8b1f6b37b5e713a6532ecce7e20f55c00cb4813
This commit is contained in:
commit
94cd722e31
|
@ -323,7 +323,7 @@ impl<'a> Arbitrary<'a> for Signature {
|
||||||
signature_bytes[..32].copy_from_slice(&bytes);
|
signature_bytes[..32].copy_from_slice(&bytes);
|
||||||
signature_bytes[32..].copy_from_slice(&bytes);
|
signature_bytes[32..].copy_from_slice(&bytes);
|
||||||
|
|
||||||
Ok(Signature{
|
Ok(Signature {
|
||||||
signature: secp256k1::ecdsa::Signature::from_compact(&signature_bytes).unwrap(),
|
signature: secp256k1::ecdsa::Signature::from_compact(&signature_bytes).unwrap(),
|
||||||
sighash_type: EcdsaSighashType::arbitrary(u)?,
|
sighash_type: EcdsaSighashType::arbitrary(u)?,
|
||||||
})
|
})
|
||||||
|
|
|
@ -1479,7 +1479,7 @@ impl<'a> Arbitrary<'a> for EcdsaSighashType {
|
||||||
2 => Ok(EcdsaSighashType::Single),
|
2 => Ok(EcdsaSighashType::Single),
|
||||||
3 => Ok(EcdsaSighashType::AllPlusAnyoneCanPay),
|
3 => Ok(EcdsaSighashType::AllPlusAnyoneCanPay),
|
||||||
4 => Ok(EcdsaSighashType::NonePlusAnyoneCanPay),
|
4 => Ok(EcdsaSighashType::NonePlusAnyoneCanPay),
|
||||||
_ => Ok(EcdsaSighashType::SinglePlusAnyoneCanPay)
|
_ => Ok(EcdsaSighashType::SinglePlusAnyoneCanPay),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1495,7 +1495,7 @@ impl<'a> Arbitrary<'a> for TapSighashType {
|
||||||
3 => Ok(TapSighashType::Single),
|
3 => Ok(TapSighashType::Single),
|
||||||
4 => Ok(TapSighashType::AllPlusAnyoneCanPay),
|
4 => Ok(TapSighashType::AllPlusAnyoneCanPay),
|
||||||
5 => Ok(TapSighashType::NonePlusAnyoneCanPay),
|
5 => Ok(TapSighashType::NonePlusAnyoneCanPay),
|
||||||
_ => Ok(TapSighashType::SinglePlusAnyoneCanPay)
|
_ => Ok(TapSighashType::SinglePlusAnyoneCanPay),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,9 @@ pub struct HashEngine {
|
||||||
k0: u64,
|
k0: u64,
|
||||||
k1: u64,
|
k1: u64,
|
||||||
bytes_hashed: u64, // how many bytes we've processed
|
bytes_hashed: u64, // how many bytes we've processed
|
||||||
state: State, // hash State
|
state: State, // hash State
|
||||||
tail: u64, // unprocessed bytes le
|
tail: u64, // unprocessed bytes le
|
||||||
ntail: usize, // how many bytes in tail are valid
|
ntail: usize, // how many bytes in tail are valid
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HashEngine {
|
impl HashEngine {
|
||||||
|
@ -134,7 +134,8 @@ impl crate::HashEngine for HashEngine {
|
||||||
|
|
||||||
if self.ntail != 0 {
|
if self.ntail != 0 {
|
||||||
needed = 8 - self.ntail;
|
needed = 8 - self.ntail;
|
||||||
self.tail |= unsafe { u8to64_le(msg, 0, cmp::min(bytes_hashed, needed)) } << (8 * self.ntail);
|
self.tail |=
|
||||||
|
unsafe { u8to64_le(msg, 0, cmp::min(bytes_hashed, needed)) } << (8 * self.ntail);
|
||||||
if bytes_hashed < needed {
|
if bytes_hashed < needed {
|
||||||
self.ntail += bytes_hashed;
|
self.ntail += bytes_hashed;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -256,7 +256,7 @@ impl<'a> Arbitrary<'a> for Sequence {
|
||||||
5 => Ok(Sequence::from_consensus(relative::Height::MAX.to_consensus_u32())),
|
5 => Ok(Sequence::from_consensus(relative::Height::MAX.to_consensus_u32())),
|
||||||
6 => Ok(Sequence::from_consensus(relative::Time::MIN.to_consensus_u32())),
|
6 => Ok(Sequence::from_consensus(relative::Time::MIN.to_consensus_u32())),
|
||||||
7 => Ok(Sequence::from_consensus(relative::Time::MAX.to_consensus_u32())),
|
7 => Ok(Sequence::from_consensus(relative::Time::MAX.to_consensus_u32())),
|
||||||
_ => Ok(Sequence(u.arbitrary()?))
|
_ => Ok(Sequence(u.arbitrary()?)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ impl<'a> Arbitrary<'a> for Sequence {
|
||||||
1 => Ok(Sequence::ZERO),
|
1 => Ok(Sequence::ZERO),
|
||||||
2 => Ok(Sequence::MIN_NO_RBF),
|
2 => Ok(Sequence::MIN_NO_RBF),
|
||||||
3 => Ok(Sequence::ENABLE_RBF_NO_LOCKTIME),
|
3 => Ok(Sequence::ENABLE_RBF_NO_LOCKTIME),
|
||||||
_ => Ok(Sequence(u.arbitrary()?))
|
_ => Ok(Sequence(u.arbitrary()?)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ impl<'a> Arbitrary<'a> for Version {
|
||||||
match choice {
|
match choice {
|
||||||
0 => Ok(Version::ONE),
|
0 => Ok(Version::ONE),
|
||||||
1 => Ok(Version::TWO),
|
1 => Ok(Version::TWO),
|
||||||
_ => Ok(Version(u.arbitrary()?))
|
_ => Ok(Version(u.arbitrary()?)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//! Implements `FeeRate` and assoctiated features.
|
//! Implements `FeeRate` and assoctiated features.
|
||||||
|
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::ops::{Add, Sub, Div, Mul, AddAssign, SubAssign};
|
use core::ops::{Add, AddAssign, Div, Mul, Sub, SubAssign};
|
||||||
|
|
||||||
#[cfg(feature = "arbitrary")]
|
#[cfg(feature = "arbitrary")]
|
||||||
use arbitrary::{Arbitrary, Unstructured};
|
use arbitrary::{Arbitrary, Unstructured};
|
||||||
|
@ -154,25 +154,19 @@ impl Add for FeeRate {
|
||||||
impl Add<FeeRate> for &FeeRate {
|
impl Add<FeeRate> for &FeeRate {
|
||||||
type Output = FeeRate;
|
type Output = FeeRate;
|
||||||
|
|
||||||
fn add(self, other: FeeRate) -> <FeeRate as Add>::Output {
|
fn add(self, other: FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 + other.0) }
|
||||||
FeeRate(self.0 + other.0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Add<&FeeRate> for FeeRate {
|
impl Add<&FeeRate> for FeeRate {
|
||||||
type Output = FeeRate;
|
type Output = FeeRate;
|
||||||
|
|
||||||
fn add(self, other: &FeeRate) -> <FeeRate as Add>::Output {
|
fn add(self, other: &FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 + other.0) }
|
||||||
FeeRate(self.0 + other.0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> Add<&'a FeeRate> for &'b FeeRate {
|
impl<'a, 'b> Add<&'a FeeRate> for &'b FeeRate {
|
||||||
type Output = FeeRate;
|
type Output = FeeRate;
|
||||||
|
|
||||||
fn add(self, other: &'a FeeRate) -> <FeeRate as Add>::Output {
|
fn add(self, other: &'a FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 + other.0) }
|
||||||
FeeRate(self.0 + other.0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Sub for FeeRate {
|
impl Sub for FeeRate {
|
||||||
|
@ -184,25 +178,19 @@ impl Sub for FeeRate {
|
||||||
impl Sub<FeeRate> for &FeeRate {
|
impl Sub<FeeRate> for &FeeRate {
|
||||||
type Output = FeeRate;
|
type Output = FeeRate;
|
||||||
|
|
||||||
fn sub(self, other: FeeRate) -> <FeeRate as Add>::Output {
|
fn sub(self, other: FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 - other.0) }
|
||||||
FeeRate(self.0 - other.0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Sub<&FeeRate> for FeeRate {
|
impl Sub<&FeeRate> for FeeRate {
|
||||||
type Output = FeeRate;
|
type Output = FeeRate;
|
||||||
|
|
||||||
fn sub(self, other: &FeeRate) -> <FeeRate as Add>::Output {
|
fn sub(self, other: &FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 - other.0) }
|
||||||
FeeRate(self.0 - other.0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'b> Sub<&'a FeeRate> for &'b FeeRate {
|
impl<'a, 'b> Sub<&'a FeeRate> for &'b FeeRate {
|
||||||
type Output = FeeRate;
|
type Output = FeeRate;
|
||||||
|
|
||||||
fn sub(self, other: &'a FeeRate) -> <FeeRate as Add>::Output {
|
fn sub(self, other: &'a FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 - other.0) }
|
||||||
FeeRate(self.0 - other.0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes the ceiling so that the fee computation is conservative.
|
/// Computes the ceiling so that the fee computation is conservative.
|
||||||
|
|
Loading…
Reference in New Issue