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

Function write_msg_to_gstore

devtools/gossmap-compress.c:294–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294static void write_msg_to_gstore(int outfd, const u8 *msg TAKES)
295{
296 struct gossip_hdr hdr;
297
298 hdr.flags = CPU_TO_BE16(GOSSIP_STORE_COMPLETED_BIT);
299 hdr.len = cpu_to_be16(tal_bytelen(msg));
300 hdr.timestamp = 0;
301 hdr.crc = cpu_to_be32(crc32c(0, msg, tal_bytelen(msg)));
302
303 if (!write_all(outfd, &hdr, sizeof(hdr))
304 || !write_all(outfd, msg, tal_bytelen(msg))) {
305 err(1, "Writing gossip_store");
306 }
307 tal_free_if_taken(msg);
308}
309
310/* BOLT #7:
311 * 1. type: 256 (`channel_announcement`)

Callers 3

write_announceFunction · 0.85
write_updateFunction · 0.85
write_uuidFunction · 0.85

Calls 7

cpu_to_be16Function · 0.85
tal_bytelenFunction · 0.85
cpu_to_be32Function · 0.85
crc32cFunction · 0.85
errFunction · 0.85
tal_free_if_takenFunction · 0.85
write_allFunction · 0.50

Tested by

no test coverage detected