p2p: group struct and impl for V1NetworkMessage
What changed, and why it matters
This commit simply moves the V1NetworkMessage struct definition and its associated implementation block next to each other in the same source file. There are no code behavior changes, no security fixes, and no functional modifications.
No action needed. This is a non-functional refactoring change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff is a pure code reorganization in p2p/src/message.rs. It deletes the V1NetworkMessage struct declaration from one location and reinserts it immediately before its impl block. The struct fields, derives, visibility, and impl contents are unchanged. No logic, parsing, serialization, or validation behavior is modified.
Changed components
p2p/src/message.rsInspect captured patch +9 / −9
diff --git a/p2p/src/message.rs b/p2p/src/message.rs
index c5b05411..ba138a1d 100644
--- a/p2p/src/message.rs
+++ b/p2p/src/message.rs
@@ -183,15 +183,6 @@ crate::decoder_newtype! {
}
}
-/// A Network message using the v1 p2p protocol.
-#[derive(Clone, Debug, PartialEq, Eq)]
-pub struct V1NetworkMessage {
- magic: Magic,
- payload: NetworkMessage,
- payload_len: u32,
- checksum: [u8; 4],
-}
-
/// A v1 message header used to describe the incoming payload.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct V1MessageHeader {
@@ -747,6 +738,15 @@ impl NetworkMessage {
}
}
+/// A Network message using the v1 p2p protocol.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub struct V1NetworkMessage {
+ magic: Magic,
+ payload: NetworkMessage,
+ payload_len: u32,
+ checksum: [u8; 4],
+}
+
impl V1NetworkMessage {
/// Constructs a new [`V1NetworkMessage`]
///
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.