Skip to main content

Module p2p_frame

Module p2p_frame 

Source
Expand description

Bitcoin P2P message framing: magic, 12-byte command, LE length, 4-byte checksum, payload.

Shared between crates so crate::p2p_framing::MAX_PROTOCOL_MESSAGE_LENGTH and checksum rules stay single-sourced.

Functionsยง

bitcoin_p2p_payload_checksum
First four bytes of double-SHA256(payload), Bitcoin P2P checksum.
build_p2p_frame
Build a full P2P frame: magic + command (null-padded) + length + checksum + payload.
parse_p2p_frame
Parse the 24-byte header and verify checksum; returns command name and payload slice.