dualfund: when dropping to chain, only drop if we have a commitment tx

You can't publish a tx you don't have!
This commit is contained in:
niftynei 2023-10-27 14:39:34 -05:00 committed by Rusty Russell
parent b9376ac66b
commit 30babab1ed

View File

@ -390,10 +390,13 @@ void drop_to_chain(struct lightningd *ld, struct channel *channel,
/* We need to drop *every* commitment transaction to chain */
if (!cooperative && !list_empty(&channel->inflights)) {
list_for_each(&channel->inflights, inflight, list)
list_for_each(&channel->inflights, inflight, list) {
if (!inflight->last_tx)
continue;
tx = sign_and_send_last(tmpctx, ld, channel, cmd_id,
inflight->last_tx,
&inflight->last_sig);
}
} else
tx = sign_and_send_last(tmpctx, ld, channel, cmd_id, channel->last_tx,
&channel->last_sig);