Skip to main content

parse_p2p_frame

Function parse_p2p_frame 

Source
pub fn parse_p2p_frame(
    data: &[u8],
    expected_magic_le: u32,
    command_allowed: impl Fn(&str) -> bool,
) -> Result<(&str, &[u8])>
Expand description

Parse the 24-byte header and verify checksum; returns command name and payload slice.

command_allowed should return true for commands this node/process accepts (e.g. allowlist).