diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c index 751f45af7..24f0d972c 100644 --- a/lightningd/channel_control.c +++ b/lightningd/channel_control.c @@ -1599,7 +1599,7 @@ bool channel_tell_depth(struct lightningd *ld, case DUALOPEND_AWAITING_LOCKIN: log_debug(channel->log, "Funding tx %s confirmed, telling peer", txidstr); - dualopen_tell_depth(channel->owner, channel, + dualopend_tell_depth(channel, txid, depth); /* We're done, don't track depth any more. */ return true; diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 066f31e40..2cdd5598b 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -1824,16 +1824,23 @@ static void handle_channel_locked(struct subd *dualopend, return; } - - -void dualopen_tell_depth(struct subd *dualopend, - struct channel *channel, - const struct bitcoin_txid *txid, - u32 depth) +void dualopend_tell_depth(struct channel *channel, + const struct bitcoin_txid *txid, + u32 depth) { const u8 *msg; u32 to_go; + if (!channel->owner) { + log_debug(channel->log, + "Funding tx %s confirmed, but peer disconnected", + type_to_string(tmpctx, struct bitcoin_txid, txid)); + return; + } + + log_debug(channel->log, + "Funding tx %s confirmed, telling peer", + type_to_string(tmpctx, struct bitcoin_txid, txid)); if (depth < channel->minimum_depth) { to_go = channel->minimum_depth - depth; } else @@ -1851,7 +1858,7 @@ void dualopen_tell_depth(struct subd *dualopend, to_go)); msg = towire_dualopend_depth_reached(NULL, depth); - subd_send_msg(dualopend, take(msg)); + subd_send_msg(channel->owner, take(msg)); } else channel_set_billboard(channel, false, tal_fmt(tmpctx, "Funding needs %d more" diff --git a/lightningd/dual_open_control.h b/lightningd/dual_open_control.h index e3e0e9267..8bacce793 100644 --- a/lightningd/dual_open_control.h +++ b/lightningd/dual_open_control.h @@ -14,10 +14,9 @@ bool peer_restart_dualopend(struct peer *peer, struct channel *channel, bool from_abort); -void dualopen_tell_depth(struct subd *dualopend, - struct channel *channel, - const struct bitcoin_txid *txid, - u32 depth); +void dualopend_tell_depth(struct channel *channel, + const struct bitcoin_txid *txid, + u32 depth); /* Close connection to an unsaved channel */ void channel_unsaved_close_conn(struct channel *channel, const char *why);