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

Function gossmap_iter_fast_forward

common/gossmap.c:1984–2004  ·  view source on GitHub ↗

For fast-forwarding to the given timestamp */

Source from the content-addressed store, hash-verified

1982
1983/* For fast-forwarding to the given timestamp */
1984void gossmap_iter_fast_forward(const struct gossmap *map,
1985 struct gossmap_iter *iter,
1986 u64 timestamp)
1987{
1988 /* If we have reopened (unlikely!), we need to restart iteration */
1989 if (iter->generation != map->generation) {
1990 iter->generation = map->generation;
1991 iter->offset = 1;
1992 }
1993
1994 while (iter->offset + sizeof(struct gossip_hdr) <= map->map_size) {
1995 struct gossip_hdr ghdr;
1996
1997 map_copy(map, iter->offset, &ghdr, sizeof(ghdr));
1998
1999 if (be32_to_cpu(ghdr.timestamp) >= timestamp)
2000 break;
2001
2002 iter->offset += be16_to_cpu(ghdr.len) + sizeof(ghdr);
2003 }
2004}
2005
2006void gossmap_iter_end(const struct gossmap *map, struct gossmap_iter *iter)
2007{

Callers 1

update_recent_timestampFunction · 0.85

Calls 3

map_copyFunction · 0.85
be32_to_cpuFunction · 0.85
be16_to_cpuFunction · 0.85

Tested by

no test coverage detected