2024-12-01 automated rustfmt nightly
This commit is contained in:
parent
230b9e5ca0
commit
0990b30035
|
@ -1133,9 +1133,7 @@ impl InputWeightPrediction {
|
|||
/// Computes the **signature weight** added to a transaction by an input with this weight prediction,
|
||||
/// not counting the prevout (txid, index), sequence, potential witness flag bytes or the witness count varint.
|
||||
#[deprecated(since = "TBD", note = "use `InputWeightPrediction::witness_weight()` instead")]
|
||||
pub const fn weight(&self) -> Weight {
|
||||
Self::witness_weight(self)
|
||||
}
|
||||
pub const fn weight(&self) -> Weight { Self::witness_weight(self) }
|
||||
|
||||
/// Computes the signature, prevout (txid, index), and sequence weights of this weight
|
||||
/// prediction.
|
||||
|
@ -1972,7 +1970,7 @@ mod tests {
|
|||
InputWeightPrediction::P2PKH_COMPRESSED_MAX,
|
||||
InputWeightPrediction::P2PKH_UNCOMPRESSED_MAX,
|
||||
InputWeightPrediction::P2TR_KEY_DEFAULT_SIGHASH,
|
||||
InputWeightPrediction::P2TR_KEY_NON_DEFAULT_SIGHASH
|
||||
InputWeightPrediction::P2TR_KEY_NON_DEFAULT_SIGHASH,
|
||||
];
|
||||
|
||||
let weight = predict_weight_from_slices(&predict, &[1]);
|
||||
|
|
|
@ -237,8 +237,8 @@ pub mod parse {
|
|||
#[doc(inline)]
|
||||
pub use units::parse::{
|
||||
hex_check_unprefixed, hex_remove_prefix, hex_u128, hex_u128_unchecked, hex_u128_unprefixed,
|
||||
hex_u32, hex_u32_unchecked, hex_u32_unprefixed, int,
|
||||
ParseIntError, PrefixedHexError, UnprefixedHexError,
|
||||
hex_u32, hex_u32_unchecked, hex_u32_unprefixed, int, ParseIntError, PrefixedHexError,
|
||||
UnprefixedHexError,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -256,8 +256,7 @@ impl Psbt {
|
|||
{
|
||||
continue;
|
||||
} else if derivation2.len() <= derivation1.len()
|
||||
&& derivation2[..]
|
||||
== derivation1[derivation1.len() - derivation2.len()..]
|
||||
&& derivation2[..] == derivation1[derivation1.len() - derivation2.len()..]
|
||||
{
|
||||
entry.insert((fingerprint1, derivation1));
|
||||
continue;
|
||||
|
@ -2117,14 +2116,16 @@ mod tests {
|
|||
assert_eq!(psbt1, psbt2);
|
||||
}
|
||||
|
||||
|
||||
// https://github.com/rust-bitcoin/rust-bitcoin/issues/3628
|
||||
#[test]
|
||||
fn test_combine_psbt_fuzz_3628() {
|
||||
let mut psbt1 = hex_psbt(include_str!("../../tests/data/psbt_fuzz1.hex")).unwrap();
|
||||
let psbt2 = hex_psbt(include_str!("../../tests/data/psbt_fuzz2.hex")).unwrap();
|
||||
|
||||
assert!(matches!(psbt1.combine(psbt2).unwrap_err(), Error::CombineInconsistentKeySources(_)));
|
||||
assert!(matches!(
|
||||
psbt1.combine(psbt2).unwrap_err(),
|
||||
Error::CombineInconsistentKeySources(_)
|
||||
));
|
||||
}
|
||||
|
||||
#[cfg(feature = "rand-std")]
|
||||
|
|
|
@ -331,15 +331,11 @@ impl std::error::Error for PrefixedHexError {
|
|||
}
|
||||
|
||||
impl From<MissingPrefixError> for PrefixedHexError {
|
||||
fn from(e: MissingPrefixError) -> Self {
|
||||
Self(PrefixedHexErrorInner::MissingPrefix(e))
|
||||
}
|
||||
fn from(e: MissingPrefixError) -> Self { Self(PrefixedHexErrorInner::MissingPrefix(e)) }
|
||||
}
|
||||
|
||||
impl From<ParseIntError> for PrefixedHexError {
|
||||
fn from(e: ParseIntError) -> Self {
|
||||
Self(PrefixedHexErrorInner::ParseInt(e))
|
||||
}
|
||||
fn from(e: ParseIntError) -> Self { Self(PrefixedHexErrorInner::ParseInt(e)) }
|
||||
}
|
||||
|
||||
/// Error returned when parsing an integer from a hex string that is not supposed to contain a prefix.
|
||||
|
@ -381,15 +377,11 @@ impl std::error::Error for UnprefixedHexError {
|
|||
}
|
||||
|
||||
impl From<ContainsPrefixError> for UnprefixedHexError {
|
||||
fn from(e: ContainsPrefixError) -> Self {
|
||||
Self(UnprefixedHexErrorInner::ContainsPrefix(e))
|
||||
}
|
||||
fn from(e: ContainsPrefixError) -> Self { Self(UnprefixedHexErrorInner::ContainsPrefix(e)) }
|
||||
}
|
||||
|
||||
impl From<ParseIntError> for UnprefixedHexError {
|
||||
fn from(e: ParseIntError) -> Self {
|
||||
Self(UnprefixedHexErrorInner::ParseInt(e))
|
||||
}
|
||||
fn from(e: ParseIntError) -> Self { Self(UnprefixedHexErrorInner::ParseInt(e)) }
|
||||
}
|
||||
|
||||
/// Error returned when a hex string is missing a prefix (e.g. `0x`).
|
||||
|
|
|
@ -98,7 +98,7 @@ struct CommonTraits {
|
|||
}
|
||||
|
||||
/// A struct that includes all types that implement `Default`.
|
||||
#[derive(Default)] // C-COMMON-TRAITS: `Default`
|
||||
#[derive(Default)] // C-COMMON-TRAITS: `Default`
|
||||
struct Default {
|
||||
a: Amount,
|
||||
b: SignedAmount,
|
||||
|
@ -196,9 +196,7 @@ fn api_can_use_all_types_from_module_locktime_relative() {
|
|||
|
||||
#[test]
|
||||
fn api_can_use_all_types_from_module_parse() {
|
||||
use bitcoin_units::parse::{
|
||||
ParseIntError, PrefixedHexError, UnprefixedHexError,
|
||||
};
|
||||
use bitcoin_units::parse::{ParseIntError, PrefixedHexError, UnprefixedHexError};
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in New Issue