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

Function gossmap_iter_fast_forward

common/gossmap.c:1990–2010  ·  view source on GitHub ↗

For fast-forwarding to the given timestamp */

Source from the content-addressed store, hash-verified

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

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