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

Function arm_refresh_timer

lightningd/channel_gossip.c:593–619  ·  view source on GitHub ↗

Based on existing update, schedule next refresh */

Source from the content-addressed store, hash-verified

591
592/* Based on existing update, schedule next refresh */
593static void arm_refresh_timer(struct channel *channel)
594{
595 struct lightningd *ld = channel->peer->ld;
596 struct channel_gossip *cg = channel->channel_gossip;
597 struct timeabs now = clock_time(), due;
598 u32 timestamp;
599
600 if (!channel_update_details(cg->cupdate, &timestamp, NULL)) {
601 log_broken(channel->log, "Missing channel_update for refresh?");
602 return;
603 }
604 due.ts.tv_sec = timestamp;
605 due.ts.tv_nsec = 0;
606
607 due = timeabs_add(due,
608 time_from_sec(GOSSIP_PRUNE_INTERVAL(ld->dev_fast_gossip_prune)
609 - GOSSIP_BEFORE_DEADLINE(ld->dev_fast_gossip_prune)));
610
611 /* In case it's passed, timer should be zero */
612 if (time_after(now, due))
613 due = now;
614
615 cg->refresh_timer = new_reltimer(ld->timers, cg,
616 time_between(due, now),
617 cupdate_timer_refresh,
618 channel);
619}
620
621static void cupdate_timer_refresh(struct channel *channel)
622{

Callers 4

cupdate_timer_refreshFunction · 0.85
set_gossip_stateFunction · 0.85
channel_gossip_init_doneFunction · 0.85

Calls 6

clock_timeFunction · 0.85
timeabs_addFunction · 0.85
time_from_secFunction · 0.85
time_afterFunction · 0.85
time_betweenFunction · 0.85
channel_update_detailsFunction · 0.70

Tested by

no test coverage detected