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

Function update_recent_timestamp

connectd/multiplex.c:215–229  ·  view source on GitHub ↗

It's so common to ask for "recent" gossip (we ask for 10 minutes * ago, LND and Eclair ask for now, LDK asks for 1 hour ago) that it's * worth keeping track of where that starts, so we can skip most of * the store. */

Source from the content-addressed store, hash-verified

213 * worth keeping track of where that starts, so we can skip most of
214 * the store. */
215static void update_recent_timestamp(struct daemon *daemon)
216{
217 /* 2 hours allows for some clock drift, not too much gossip */
218 u32 recent = time_now().ts.tv_sec - 7200;
219
220 /* Only update every minute */
221 if (daemon->gossip_recent_time + 60 > recent)
222 return;
223
224 daemon->gossip_recent_time = recent;
225 daemon->gossip_store_recent_off
226 = find_gossip_store_by_timestamp(daemon->gossip_store_fd,
227 daemon->gossip_store_recent_off,
228 daemon->gossip_recent_time);
229}
230
231/* This is called once we need it: otherwise, the gossip_store may not exist,
232 * since we start at the same time as gossipd itself. */

Callers 2

setup_gossip_storeFunction · 0.85

Calls 2

time_nowFunction · 0.85

Tested by

no test coverage detected