~ 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. */
| 44 | * peer disconnects, and generate a `channel_update` to tell the world lazily |
| 45 | * when someone asks. */ |
| 46 | static 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. */ |
| 61 | static void peer_enable_channels(struct daemon *daemon, const struct node *node) |
no test coverage detected