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

Function csum_matches

common/gossmap.c:800–812  ·  view source on GitHub ↗

Extra sanity check (if it's cheap): does crc match? */

Source from the content-addressed store, hash-verified

798
799/* Extra sanity check (if it's cheap): does crc match? */
800static bool csum_matches(const struct gossmap *map,
801 u64 off,
802 u32 timestamp,
803 u16 msglen,
804 u32 crc)
805{
806 /* Don't waste resources reading if we don't have mmap */
807 if (!map->mmap)
808 return true;
809
810 assert(off + msglen <= map->map_size);
811 return crc32c(timestamp, map->mmap + off, msglen) == crc;
812}
813
814/* Returns false only if must_be_clean is true. */
815static bool map_catchup(struct gossmap *map,

Callers 1

map_catchupFunction · 0.85

Calls 1

crc32cFunction · 0.85

Tested by

no test coverage detected