What changed, and why it matters
This commit only runs an automatic code formatter (rustfmt) across three source files. It changes whitespace, line breaks, and indentation but does not alter any program logic, function behavior, or security properties. There is no security issue here.
No action needed; this is a benign style-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff is a pure formatting patch: it re-wraps long #[deprecated] attributes, breaks long use import lines, and adjusts indentation and trailing commas in AddrV2Message encoder/decoder construction and AddrV2Payload decoder implementation. No functional code, type signatures, algorithms, or cryptographic operations were modified.
Changed components
Inspect captured patch +20 / −18
diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs
index a70a63ea..8591699f 100644
--- a/bitcoin/src/crypto/key.rs
+++ b/bitcoin/src/crypto/key.rs
@@ -825,7 +825,10 @@ impl CompressedPublicKey {
/// # Errors
///
/// See [`secp256k1::PublicKey::from_slice`].
- #[deprecated(since = "TBD", note = "use `from_bytes` instead; if you only have a slice, use `<&[u8; 33]>::try_from` first")]
+ #[deprecated(
+ since = "TBD",
+ note = "use `from_bytes` instead; if you only have a slice, use `<&[u8; 33]>::try_from` first"
+ )]
pub fn from_slice(data: &[u8]) -> Result<Self, secp256k1::Error> {
let bytes_arr = data.try_into().map_err(|_| secp256k1::Error::InvalidPublicKey)?;
Self::from_bytes(bytes_arr)
diff --git a/p2p/src/address.rs b/p2p/src/address.rs
index a29b44db..c9d26e16 100644
--- a/p2p/src/address.rs
+++ b/p2p/src/address.rs
@@ -15,7 +15,8 @@ use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV
use arbitrary::{Arbitrary, Unstructured};
use bitcoin::consensus::encode::{self, Decodable, Encodable, ReadExt, WriteExt};
use encoding::{
- ArrayDecoder, ArrayEncoder, ByteVecDecoder, BytesEncoder, CompactSizeEncoder, CompactSizeU64Decoder, Decoder2, Decoder4, Encoder2, Encoder4
+ ArrayDecoder, ArrayEncoder, ByteVecDecoder, BytesEncoder, CompactSizeEncoder,
+ CompactSizeU64Decoder, Decoder2, Decoder4, Encoder2, Encoder4,
};
use internals::array::ArrayExt;
use internals::write_err;
@@ -858,18 +859,17 @@ impl encoding::Encodable for AddrV2Message {
type Encoder<'e> = AddrV2MessageEncoder<'e>;
fn encoder(&self) -> Self::Encoder<'_> {
- AddrV2MessageEncoder::new(
- Encoder4::new(
- ArrayEncoder::without_length_prefix(self.time.to_le_bytes()),
- CompactSizeEncoder::new_u64(self.services.to_u64()),
- self.addr.encoder(),
- ArrayEncoder::without_length_prefix(self.port.to_be_bytes())
- )
- )
+ AddrV2MessageEncoder::new(Encoder4::new(
+ ArrayEncoder::without_length_prefix(self.time.to_le_bytes()),
+ CompactSizeEncoder::new_u64(self.services.to_u64()),
+ self.addr.encoder(),
+ ArrayEncoder::without_length_prefix(self.port.to_be_bytes()),
+ ))
}
}
-type AddrV2MessageInnerDecoder = Decoder4<ArrayDecoder<4>, CompactSizeU64Decoder, AddrV2Decoder, ArrayDecoder<2>>;
+type AddrV2MessageInnerDecoder =
+ Decoder4<ArrayDecoder<4>, CompactSizeU64Decoder, AddrV2Decoder, ArrayDecoder<2>>;
/// The decoder for an [`AddrV2Message`].
pub struct AddrV2MessageDecoder(AddrV2MessageInnerDecoder);
@@ -904,8 +904,8 @@ impl encoding::Decodable for AddrV2Message {
ArrayDecoder::new(),
CompactSizeU64Decoder::new(),
AddrV2::decoder(),
- ArrayDecoder::new())
- )
+ ArrayDecoder::new(),
+ ))
}
}
diff --git a/p2p/src/message.rs b/p2p/src/message.rs
index 5e4178cd..335e2a02 100644
--- a/p2p/src/message.rs
+++ b/p2p/src/message.rs
@@ -536,7 +536,8 @@ impl encoding::Encodable for AddrV2Payload {
fn encoder(&self) -> Self::Encoder<'_> {
Encoder2::new(
- CompactSizeEncoder::new(self.0.len()), SliceEncoder::without_length_prefix(&self.0)
+ CompactSizeEncoder::new(self.0.len()),
+ SliceEncoder::without_length_prefix(&self.0),
)
}
}
@@ -557,7 +558,7 @@ impl encoding::Decoder for AddrV2PayloadDecoder {
#[inline]
fn end(self) -> Result<Self::Output, Self::Error> {
- Ok(AddrV2Payload(self.0.end().map_err(AddrV2PayloadDecoderError)?))
+ Ok(AddrV2Payload(self.0.end().map_err(AddrV2PayloadDecoderError)?))
}
#[inline]
@@ -566,9 +567,7 @@ impl encoding::Decoder for AddrV2PayloadDecoder {
impl encoding::Decodable for AddrV2Payload {
type Decoder = AddrV2PayloadDecoder;
- fn decoder() -> Self::Decoder {
- AddrV2PayloadDecoder(VecDecoder::new())
- }
+ fn decoder() -> Self::Decoder { AddrV2PayloadDecoder(VecDecoder::new()) }
}
/// An error decoding a [`AddrV2Payload`].
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.