Extra sanity check (if it's cheap): does crc match? */
| 798 | |
| 799 | /* Extra sanity check (if it's cheap): does crc match? */ |
| 800 | static 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. */ |
| 815 | static bool map_catchup(struct gossmap *map, |