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

Function check_timestamps

gossipd/seeker.c:654–689  ·  view source on GitHub ↗

They gave us timestamps. Do we want updated versions? */

Source from the content-addressed store, hash-verified

652
653/* They gave us timestamps. Do we want updated versions? */
654static void check_timestamps(struct seeker *seeker,
655 struct gossmap *gossmap,
656 struct gossmap_chan *c,
657 const struct channel_update_timestamps *ts,
658 struct peer *peer)
659{
660 u8 *stale;
661 u8 query_flag = 0;
662 struct short_channel_id scid;
663
664 /* BOLT #7:
665 * * `timestamp_node_id_1` is the timestamp of the `channel_update`
666 * for `node_id_1`, or 0 if there was no `channel_update` from that
667 * node.
668 * * `timestamp_node_id_2` is the timestamp of the `channel_update`
669 * for `node_id_2`, or 0 if there was no `channel_update` from that
670 * node.
671 */
672 if (want_update(gossmap, ts->timestamp_node_id_1, c, 0))
673 query_flag |= SCID_QF_UPDATE1;
674 if (want_update(gossmap, ts->timestamp_node_id_2, c, 1))
675 query_flag |= SCID_QF_UPDATE2;
676
677 if (!query_flag)
678 return;
679
680 /* Add in flags if we're already getting it. */
681 scid = gossmap_chan_scid(gossmap, c);
682 stale = uintmap_get(&seeker->stale_scids, scid.u64);
683 if (!stale) {
684 stale = talz(seeker, u8);
685 uintmap_add(&seeker->stale_scids, scid.u64, stale);
686 set_preferred_peer(seeker, peer);
687 }
688 *stale |= query_flag;
689}
690
691static bool add_unknown_scid(struct seeker *seeker,
692 struct short_channel_id scid,

Callers 1

process_scid_probeFunction · 0.85

Calls 3

want_updateFunction · 0.85
gossmap_chan_scidFunction · 0.85
set_preferred_peerFunction · 0.85

Tested by

no test coverage detected