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

Function local_mods_remove_channels

plugins/establish_onion_path.c:84–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84static void local_mods_remove_channels(struct gossmap_localmods *mods,
85 const struct gossmap *gossmap,
86 const struct node_id *selfid,
87 const struct node_id *peerid)
88{
89 const struct gossmap_node *peer = gossmap_find_node(gossmap, peerid);
90 const struct gossmap_node *self = gossmap_find_node(gossmap, selfid);
91 const bool enabled_off = false;
92
93 if (!peer || !self)
94 return;
95
96 for (size_t i = 0; i < self->num_chans; i++) {
97 int dir;
98 struct short_channel_id_dir scidd;
99 struct gossmap_chan *c = gossmap_nth_chan(gossmap, self, i, &dir);
100
101 if (gossmap_nth_node(gossmap, c, !dir) != peer)
102 continue;
103 scidd.scid = gossmap_chan_scid(gossmap, c);
104 scidd.dir = dir;
105
106 /* Set enabled -> false for this channel */
107 gossmap_local_updatechan(mods, &scidd, &enabled_off,
108 NULL, NULL, NULL, NULL, NULL);
109 }
110}
111
112/* We add fake channels to gossmap to represent current outgoing connections.
113 * This allows dijkstra to find transient connections as well. */

Callers 1

gossmods_from_listpeersFunction · 0.85

Calls 5

gossmap_find_nodeFunction · 0.85
gossmap_nth_chanFunction · 0.85
gossmap_nth_nodeFunction · 0.85
gossmap_chan_scidFunction · 0.85
gossmap_local_updatechanFunction · 0.85

Tested by

no test coverage detected