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

Function csum_matches

common/gossmap.c:804–816  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 1

map_catchupFunction · 0.85

Calls 1

crc32cFunction · 0.85

Tested by

no test coverage detected