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

Function peer_disable_channels

gossipd/gossipd.c:46–58  ·  view source on GitHub ↗

~ A channel consists of a `struct half_chan` for each direction, each of * which has a `flags` word from the `channel_update`; bit 1 is * ROUTING_FLAGS_DISABLED in the `channel_update`. But we also keep a local * whole-channel flag which indicates it's not available; we use this when a * peer disconnects, and generate a `channel_update` to tell the world lazily * when someone asks. */

Source from the content-addressed store, hash-verified

44 * peer disconnects, and generate a `channel_update` to tell the world lazily
45 * when someone asks. */
46static void peer_disable_channels(struct daemon *daemon, const struct node *node)
47{
48 /* If this peer had a channel with us, mark it disabled. */
49 struct chan_map_iter i;
50 const struct chan *c;
51
52 for (c = first_chan(node, &i); c; c = next_chan(node, &i)) {
53 int direction;
54 if (!local_direction(daemon->rstate, c, &direction))
55 continue;
56 local_disable_chan(daemon, c, direction);
57 }
58}
59
60/*~ This cancels the soft-disables when the peer reconnects. */
61static void peer_enable_channels(struct daemon *daemon, const struct node *node)

Callers 1

destroy_peerFunction · 0.85

Calls 4

first_chanFunction · 0.85
next_chanFunction · 0.85
local_directionFunction · 0.85
local_disable_chanFunction · 0.85

Tested by

no test coverage detected