connectd: check for re-connected unsaved channels

This commit is contained in:
niftynei 2021-01-21 16:30:26 -06:00 committed by neil saitug
parent 4c9a4250bf
commit b9f867b1dd
3 changed files with 8 additions and 0 deletions

View File

@ -137,6 +137,9 @@ static struct command_result *json_connect(struct command *cmd,
if (peer) {
struct channel *channel = peer_active_channel(peer);
if (!channel)
channel = peer_unsaved_channel(peer);
if (peer->uncommitted_channel
|| (channel && channel->connected)) {
return connect_cmd_succeed(cmd, peer);

View File

@ -1323,6 +1323,8 @@ static void json_add_peer(struct lightningd *ld,
connected = true;
else {
channel = peer_active_channel(p);
if (!channel)
channel = peer_unsaved_channel(p);
connected = channel && channel->connected;
}
json_add_bool(response, "connected", connected);

View File

@ -549,6 +549,9 @@ void peer_start_openingd(struct peer *peer UNNEEDED,
struct per_peer_state *pps UNNEEDED,
const u8 *msg UNNEEDED)
{ fprintf(stderr, "peer_start_openingd called!\n"); abort(); }
/* Generated stub for peer_unsaved_channel */
struct channel *peer_unsaved_channel(struct peer *peer UNNEEDED)
{ fprintf(stderr, "peer_unsaved_channel called!\n"); abort(); }
/* Generated stub for per_peer_state_set_fds */
void per_peer_state_set_fds(struct per_peer_state *pps UNNEEDED,
int peer_fd UNNEEDED, int gossip_fd UNNEEDED, int gossip_store_fd UNNEEDED)