From bfb862564ebd73a6942dde8a96bc7ee0634ded8d Mon Sep 17 00:00:00 2001 From: niftynei Date: Tue, 19 Jan 2021 19:10:50 -0600 Subject: [PATCH] df: method for disconnecting an *unsaved* channel Since we're moving over to "unsaved channels" instead of "uncommitted_channel" struct, we need a new utility to disconnect this channe --- lightningd/dual_open_control.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 6b69310ea..464153e7e 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,26 @@ struct commit_rcvd { struct uncommitted_channel *uc; }; +/* FIXME: remove when used */ +void +unsaved_channel_disconnect(struct channel *channel, + enum log_level level, + const char *desc); +void +unsaved_channel_disconnect(struct channel *channel, + enum log_level level, + const char *desc) +{ + u8 *msg = towire_connectd_peer_disconnected(tmpctx, &channel->peer->id); + log_(channel->log, level, NULL, false, "%s", desc); + subd_send_msg(channel->peer->ld->connectd, msg); + if (channel->open_attempt && channel->open_attempt->cmd) + was_pending(command_fail(channel->open_attempt->cmd, + LIGHTNINGD, "%s", desc)); + notify_disconnect(channel->peer->ld, &channel->peer->id); +} + + static void handle_signed_psbt(struct lightningd *ld, struct subd *dualopend, const struct wally_psbt *psbt,