MCPcopy Create free account
hub / github.com/ElementsProject/lightning / encode_frame

Function encode_frame

plugins/lsps-plugin/src/proto/lsps0.rs:45–50  ·  view source on GitHub ↗

Encode raw payload bytes into an LSPS0 frame. Format: [0-1] Message type: 37913 (0x9419) as big-endian u16 [2..] Payload bytes

(payload: &[u8])

Source from the content-addressed store, hash-verified

43/// [0-1] Message type: 37913 (0x9419) as big-endian u16
44/// [2..] Payload bytes
45pub fn encode_frame(payload: &[u8]) -> Vec<u8> {
46 let mut bytes = Vec::with_capacity(2 + payload.len());
47 bytes.extend_from_slice(&LSPS0_MESSAGE_TYPE.to_be_bytes());
48 bytes.extend_from_slice(payload);
49 bytes
50}
51
52/// Decode an LSPS0 frame and return the raw payload bytes.
53///

Callers 3

test_encode_frameFunction · 0.85
encode_lsps0_frame_hexFunction · 0.85

Calls

no outgoing calls

Tested by 2

test_encode_frameFunction · 0.68