lightningd: clean up channels when connectd says peer is gone.

This is redundant now, since connectd only sends us this once we tell
it it's OK, but that's changing, so clean up now.  This means that
connectd will be able to make *unsolicited* closes, if it needs to.

We share logic with peer_please_disconnect.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-07-16 14:19:29 +09:30
committed by neil saitug
parent 9dc3880360
commit c64ce4bbf3
3 changed files with 33 additions and 24 deletions

View File

@@ -73,6 +73,8 @@ struct peer *peer_from_json(struct lightningd *ld,
void peer_connected(struct lightningd *ld, const u8 *msg);
void peer_disconnect_done(struct lightningd *ld, const u8 *msg);
void peer_active(struct lightningd *ld, const u8 *msg, int peer_fd);
/* May delete peer! */
void peer_channels_cleanup_on_disconnect(struct peer *peer);
/* Could be configurable. */
#define OUR_CHANNEL_FLAGS CHANNEL_FLAGS_ANNOUNCE_CHANNEL