What changed, and why it matters
This commit is an automated code-formatting run by the rustfmt tool. It only changes whitespace, line breaks, import order, and brace placement. There are no functional changes to the Bitcoin library, and no security implications.
No action required; this is a non-functional formatting commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff consists entirely of rustfmt-generated style changes across 11 Rust source files. Examples include reordering use statements, collapsing or expanding brace styles, removing blank lines, and rewrapping long function signatures. No logic, constants, algorithms, or public APIs were altered. The commit title and message explicitly identify it as an automated rustfmt nightly run.
Changed components
Inspect captured patch +50 / −56
diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs
index db377c5d..4802b31e 100644
--- a/bitcoin/src/blockdata/transaction.rs
+++ b/bitcoin/src/blockdata/transaction.rs
@@ -1250,9 +1250,9 @@ mod tests {
use super::*;
use crate::consensus::encode::{deserialize, serialize};
use crate::constants::WITNESS_SCALE_FACTOR;
+ use crate::parse_int;
use crate::script::ScriptSigBuf;
use crate::sighash::EcdsaSighashType;
- use crate::parse_int;
const SOME_TX: &str = "0100000001a15d57094aa7a21a28cb20b59aab8fc7d1149a3bdbcddba9c622e4f5f6a99ece010000006c493046022100f93bb0e7d8db7bd46e40132d1f8242026e045f03a0efe71bbb8e3f475e970d790221009337cd7f1f929f00cc6ff01f03729b069a7c21b59b1736ddfee5db5946c5da8c0121033b9b137ee87d5a812d6f506efdd37f0affa7ffc310711c06c7f3e097c9447c52ffffffff0100e1f505000000001976a9140389035a9225b3839e2bbf32d826a1e222031fd888ac00000000";
diff --git a/bitcoin/src/crypto/sighash.rs b/bitcoin/src/crypto/sighash.rs
index 442528ed..5908cb7c 100644
--- a/bitcoin/src/crypto/sighash.rs
+++ b/bitcoin/src/crypto/sighash.rs
@@ -2097,7 +2097,6 @@ mod tests {
),
).unwrap();
-
let spk = ScriptPubKeyBuf::from_hex_no_length_prefix(
"00141d0f172a0ecb48aee1be1f2687d2963ae33f71a1",
)
diff --git a/bitcoin/src/psbt/mod.rs b/bitcoin/src/psbt/mod.rs
index 9c20091f..838528bf 100644
--- a/bitcoin/src/psbt/mod.rs
+++ b/bitcoin/src/psbt/mod.rs
@@ -530,13 +530,18 @@ impl Psbt {
Ok((Message::from(sighash), hash_ty))
}
Wpkh => {
- let sighash = cache.p2wpkh_signature_hash(input_index, spk, utxo.amount, hash_ty)?;
+ let sighash =
+ cache.p2wpkh_signature_hash(input_index, spk, utxo.amount, hash_ty)?;
Ok((Message::from(sighash), hash_ty))
}
ShWpkh => {
let redeem_script = input.redeem_script.as_ref().expect("checked above");
- let sighash =
- cache.p2wpkh_signature_hash(input_index, redeem_script, utxo.amount, hash_ty)?;
+ let sighash = cache.p2wpkh_signature_hash(
+ input_index,
+ redeem_script,
+ utxo.amount,
+ hash_ty,
+ )?;
Ok((Message::from(sighash), hash_ty))
}
Wsh | ShWsh => {
diff --git a/consensus_encoding/src/encode/encoders.rs b/consensus_encoding/src/encode/encoders.rs
index 2b36279d..64a04c6d 100644
--- a/consensus_encoding/src/encode/encoders.rs
+++ b/consensus_encoding/src/encode/encoders.rs
@@ -26,11 +26,9 @@ impl<'sl> BytesEncoder<'sl> {
}
impl<'e, 'sl> Encoder<'e> for BytesEncoder<'sl> {
- fn current_chunk(&self) -> Option<&[u8]> {
- self.sl
- }
+ fn current_chunk(&self) -> Option<&[u8]> { self.sl }
- fn advance(&mut self)-> bool {
+ fn advance(&mut self) -> bool {
self.sl = None;
false
}
@@ -47,12 +45,9 @@ impl<const N: usize> ArrayEncoder<N> {
}
impl<'e, const N: usize> Encoder<'e> for ArrayEncoder<N> {
- fn current_chunk(&self) -> Option<&[u8]> {
- self.arr.as_ref().map(|x| &x[..])
- }
-
+ fn current_chunk(&self) -> Option<&[u8]> { self.arr.as_ref().map(|x| &x[..]) }
- fn advance(&mut self)-> bool {
+ fn advance(&mut self) -> bool {
self.arr = None;
false
}
@@ -125,7 +120,9 @@ impl<A, B, C, D> Encoder4<A, B, C, D> {
}
}
-impl<'e, A: Encoder<'e>, B: Encoder<'e>, C: Encoder<'e>, D: Encoder<'e>> Encoder<'e> for Encoder4<A, B, C, D> {
+impl<'e, A: Encoder<'e>, B: Encoder<'e>, C: Encoder<'e>, D: Encoder<'e>> Encoder<'e>
+ for Encoder4<A, B, C, D>
+{
fn current_chunk(&self) -> Option<&[u8]> { self.inner.current_chunk() }
fn advance(&mut self) -> bool { self.inner.advance() }
}
@@ -147,8 +144,15 @@ impl<A, B, C, D, E, F> Encoder6<A, B, C, D, E, F> {
}
}
-impl<'e, A: Encoder<'e>, B: Encoder<'e>, C: Encoder<'e>, D: Encoder<'e>, E: Encoder<'e>, F: Encoder<'e>> Encoder<'e>
- for Encoder6<A, B, C, D, E, F>
+impl<
+ 'e,
+ A: Encoder<'e>,
+ B: Encoder<'e>,
+ C: Encoder<'e>,
+ D: Encoder<'e>,
+ E: Encoder<'e>,
+ F: Encoder<'e>,
+ > Encoder<'e> for Encoder6<A, B, C, D, E, F>
{
fn current_chunk(&self) -> Option<&[u8]> { self.inner.current_chunk() }
fn advance(&mut self) -> bool { self.inner.advance() }
diff --git a/consensus_encoding/src/encode/mod.rs b/consensus_encoding/src/encode/mod.rs
index 831f9d81..12121107 100644
--- a/consensus_encoding/src/encode/mod.rs
+++ b/consensus_encoding/src/encode/mod.rs
@@ -12,7 +12,9 @@ pub mod encoders;
pub trait Encodable {
/// The encoder associated with this type. Conceptually, the encoder is like
/// an iterator which yields byte slices.
- type Encoder<'s>: Encoder<'s> where Self: 's;
+ type Encoder<'s>: Encoder<'s>
+ where
+ Self: 's;
/// Constructs a "default encoder" for the type.
fn encoder(&self) -> Self::Encoder<'_>;
diff --git a/primitives/src/block.rs b/primitives/src/block.rs
index e0fd97c2..b4f4d9c0 100644
--- a/primitives/src/block.rs
+++ b/primitives/src/block.rs
@@ -18,9 +18,9 @@ use hashes::{sha256d, HashEngine as _};
#[cfg(feature = "alloc")]
use crate::prelude::Vec;
+use crate::{BlockTime, CompactTarget, TxMerkleNode};
#[cfg(feature = "alloc")]
use crate::{Transaction, WitnessMerkleNode};
-use crate::{BlockTime, CompactTarget, TxMerkleNode};
#[rustfmt::skip] // Keep public re-exports separate.
#[doc(inline)]
@@ -255,16 +255,14 @@ impl Encodable for Header {
type Encoder<'e> = HeaderEncoder;
fn encoder(&self) -> Self::Encoder<'_> {
- HeaderEncoder(
- encoding::Encoder6::new(
- self.version.encoder(),
- self.prev_blockhash.encoder(),
- self.merkle_root.encoder(),
- self.time.encoder(),
- self.bits.encoder(),
- encoding::ArrayEncoder::without_length_prefix(self.nonce.to_le_bytes()),
- )
- )
+ HeaderEncoder(encoding::Encoder6::new(
+ self.version.encoder(),
+ self.prev_blockhash.encoder(),
+ self.merkle_root.encoder(),
+ self.time.encoder(),
+ self.bits.encoder(),
+ encoding::ArrayEncoder::without_length_prefix(self.nonce.to_le_bytes()),
+ ))
}
}
@@ -365,9 +363,9 @@ encoding::encoder_newtype! {
impl Encodable for Version {
type Encoder<'e> = VersionEncoder;
fn encoder(&self) -> Self::Encoder<'_> {
- VersionEncoder(
- encoding::ArrayEncoder::without_length_prefix(self.to_consensus().to_le_bytes())
- )
+ VersionEncoder(encoding::ArrayEncoder::without_length_prefix(
+ self.to_consensus().to_le_bytes(),
+ ))
}
}
@@ -391,9 +389,7 @@ encoding::encoder_newtype! {
impl Encodable for BlockHash {
type Encoder<'e> = BlockHashEncoder;
fn encoder(&self) -> Self::Encoder<'_> {
- BlockHashEncoder(
- encoding::ArrayEncoder::without_length_prefix(self.to_byte_array())
- )
+ BlockHashEncoder(encoding::ArrayEncoder::without_length_prefix(self.to_byte_array()))
}
}
diff --git a/primitives/src/merkle_tree.rs b/primitives/src/merkle_tree.rs
index 83efc1d4..cbe48b9e 100644
--- a/primitives/src/merkle_tree.rs
+++ b/primitives/src/merkle_tree.rs
@@ -28,9 +28,7 @@ encoding::encoder_newtype! {
impl encoding::Encodable for TxMerkleNode {
type Encoder<'e> = TxMerkleNodeEncoder;
fn encoder(&self) -> Self::Encoder<'_> {
- TxMerkleNodeEncoder(
- encoding::ArrayEncoder::without_length_prefix(self.to_byte_array())
- )
+ TxMerkleNodeEncoder(encoding::ArrayEncoder::without_length_prefix(self.to_byte_array()))
}
}
diff --git a/primitives/src/pow.rs b/primitives/src/pow.rs
index e79bae20..182791c4 100644
--- a/primitives/src/pow.rs
+++ b/primitives/src/pow.rs
@@ -56,9 +56,9 @@ encoding::encoder_newtype! {
impl encoding::Encodable for CompactTarget {
type Encoder<'e> = CompactTargetEncoder;
fn encoder(&self) -> Self::Encoder<'_> {
- CompactTargetEncoder(
- encoding::ArrayEncoder::without_length_prefix(self.to_consensus().to_le_bytes())
- )
+ CompactTargetEncoder(encoding::ArrayEncoder::without_length_prefix(
+ self.to_consensus().to_le_bytes(),
+ ))
}
}
diff --git a/units/src/fee_rate/mod.rs b/units/src/fee_rate/mod.rs
index 5e202839..f24a3f6a 100644
--- a/units/src/fee_rate/mod.rs
+++ b/units/src/fee_rate/mod.rs
@@ -106,25 +106,19 @@ impl FeeRate {
pub const fn to_sat_per_kwu_floor(self) -> u64 { self.to_sat_per_mvb() / 4_000 }
/// Converts to sat/kwu rounding up.
- pub const fn to_sat_per_kwu_ceil(self) -> u64 {
- self.to_sat_per_mvb().div_ceil(4_000)
- }
+ pub const fn to_sat_per_kwu_ceil(self) -> u64 { self.to_sat_per_mvb().div_ceil(4_000) }
/// Converts to sat/vB rounding down.
pub const fn to_sat_per_vb_floor(self) -> u64 { self.to_sat_per_mvb() / 1_000_000 }
/// Converts to sat/vB rounding up.
- pub const fn to_sat_per_vb_ceil(self) -> u64 {
- self.to_sat_per_mvb().div_ceil(1_000_000)
- }
+ pub const fn to_sat_per_vb_ceil(self) -> u64 { self.to_sat_per_mvb().div_ceil(1_000_000) }
/// Converts to sat/kvb rounding down.
pub const fn to_sat_per_kvb_floor(self) -> u64 { self.to_sat_per_mvb() / 1_000 }
/// Converts to sat/kvb rounding up.
- pub const fn to_sat_per_kvb_ceil(self) -> u64 {
- self.to_sat_per_mvb().div_ceil(1_000)
- }
+ pub const fn to_sat_per_kvb_ceil(self) -> u64 { self.to_sat_per_mvb().div_ceil(1_000) }
/// Checked multiplication.
///
diff --git a/units/src/time.rs b/units/src/time.rs
index 5516cf4d..5ee2990e 100644
--- a/units/src/time.rs
+++ b/units/src/time.rs
@@ -83,9 +83,7 @@ encoding::encoder_newtype! {
impl encoding::Encodable for BlockTime {
type Encoder<'e> = BlockTimeEncoder;
fn encoder(&self) -> Self::Encoder<'_> {
- BlockTimeEncoder(
- encoding::ArrayEncoder::without_length_prefix(self.to_u32().to_le_bytes())
- )
+ BlockTimeEncoder(encoding::ArrayEncoder::without_length_prefix(self.to_u32().to_le_bytes()))
}
}
diff --git a/units/src/weight.rs b/units/src/weight.rs
index 4e909cf2..1ef38343 100644
--- a/units/src/weight.rs
+++ b/units/src/weight.rs
@@ -113,9 +113,7 @@ impl Weight {
pub const fn to_vbytes_floor(self) -> u64 { self.to_wu() / Self::WITNESS_SCALE_FACTOR }
/// Converts to vB rounding up.
- pub const fn to_vbytes_ceil(self) -> u64 {
- self.to_wu().div_ceil(Self::WITNESS_SCALE_FACTOR)
- }
+ pub const fn to_vbytes_ceil(self) -> u64 { self.to_wu().div_ceil(Self::WITNESS_SCALE_FACTOR) }
/// Checked addition.
///
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.