From c42fa4404a83c9028ccf06cd90f32b610bcf7f7d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 25 Jan 2018 20:44:21 +1030 Subject: [PATCH] connect: succeed if we connect to peer and it *doesn't* go back to gossipd. The JSON connect command wouldn't terminate if peer reconnected in a state CHANNELD_AWAITING_LOCKIN or above. Signed-off-by: Rusty Russell --- lightningd/peer_control.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index b42a3046e..bc08f7a63 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -547,7 +547,7 @@ void peer_connected(struct lightningd *ld, const u8 *msg, peer_start_channeld(peer, &cs, gossip_index, peer_fd, gossip_fd, NULL, true); - return; + goto connected; case CLOSINGD_SIGEXCHANGE: case CLOSINGD_COMPLETE: @@ -559,7 +559,7 @@ void peer_connected(struct lightningd *ld, const u8 *msg, peer_start_closingd(peer, &cs, gossip_index, peer_fd, gossip_fd, true); - return; + goto connected; } abort(); } @@ -571,6 +571,7 @@ return_to_gossipd: subd_send_fd(ld->gossip, peer_fd); subd_send_fd(ld->gossip, gossip_fd); +connected: /* If we were waiting for connection, we succeeded. */ connect_succeeded(ld, &id); return;