Browse Source

lightningd/channel.c: Transfer peer to connectd only if connectd alive.

Fixes: #2677
htlc_accepted_hook
ZmnSCPxj 6 years ago
committed by Christian Decker
parent
commit
3466261b20
  1. 16
      lightningd/channel.c

16
lightningd/channel.c

@ -32,9 +32,19 @@ void channel_set_owner(struct channel *channel, struct subd *owner,
if (old_owner) {
subd_release_channel(old_owner, channel);
if (channel->connected && !connects_to_peer(owner)) {
u8 *msg = towire_connectctl_peer_disconnected(NULL,
&channel->peer->id);
subd_send_msg(channel->peer->ld->connectd, take(msg));
/* If shutting down, connectd no longer exists,
* and we should not transfer peer to connectd.
* Only transfer to connectd if connectd is
* there to be transferred to.
*/
if (channel->peer->ld->connectd) {
u8 *msg;
msg = towire_connectctl_peer_disconnected(
NULL,
&channel->peer->id);
subd_send_msg(channel->peer->ld->connectd,
take(msg));
}
}
if (reconnect) {

Loading…
Cancel
Save