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

Function check_timestamps

gossipd/seeker.c:596–628  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

594
595/* They gave us timestamps. Do we want updated versions? */
596static void check_timestamps(struct seeker *seeker,
597 struct chan *c,
598 const struct channel_update_timestamps *ts,
599 struct peer *peer)
600{
601 u8 *stale;
602 u8 query_flag = 0;
603
604 /* BOLT #7:
605 * * `timestamp_node_id_1` is the timestamp of the `channel_update`
606 * for `node_id_1`, or 0 if there was no `channel_update` from that
607 * node.
608 * * `timestamp_node_id_2` is the timestamp of the `channel_update`
609 * for `node_id_2`, or 0 if there was no `channel_update` from that
610 * node.
611 */
612 if (want_update(seeker, ts->timestamp_node_id_1, &c->half[0]))
613 query_flag |= SCID_QF_UPDATE1;
614 if (want_update(seeker, ts->timestamp_node_id_2, &c->half[1]))
615 query_flag |= SCID_QF_UPDATE2;
616
617 if (!query_flag)
618 return;
619
620 /* Add in flags if we're already getting it. */
621 stale = uintmap_get(&seeker->stale_scids, c->scid.u64);
622 if (!stale) {
623 stale = talz(seeker, u8);
624 uintmap_add(&seeker->stale_scids, c->scid.u64, stale);
625 set_preferred_peer(seeker, peer);
626 }
627 *stale |= query_flag;
628}
629
630static void process_scid_probe(struct peer *peer,
631 u32 first_blocknum, u32 number_of_blocks,

Callers 1

process_scid_probeFunction · 0.85

Calls 2

want_updateFunction · 0.85
set_preferred_peerFunction · 0.85

Tested by

no test coverage detected