From ff0e2dbd28c1ffeeb47be646f6b875b0d986c29d Mon Sep 17 00:00:00 2001 From: niftynei Date: Mon, 14 Dec 2020 18:17:49 -0600 Subject: [PATCH] df-tests: test_channel_opened_notification We weren't sending a channel_open notification for dual-funded channels. This is only sent for the 'accepter' side. We send it as soon as both funding_tx sigs have been exchanged, even though it's possible the funding transaction might be published without this having been the case. Since we fail the channel if this happens, only notifying for good/valid channels reaching the broadcast state is the right way to handle this. --- lightningd/dual_open_control.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 279c4bb96..cf10a08a2 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -1295,6 +1295,16 @@ static void handle_peer_tx_sigs_sent(struct subd *dualopend, DUALOPEND_AWAITING_LOCKIN, REASON_UNKNOWN, "Sigs exchanged, waiting for lock-in"); + + /* Mimic the old behavior, notify a channel has been opened, + * for the accepter side */ + if (channel->opener == REMOTE) + /* Tell plugins about the success */ + notify_channel_opened(dualopend->ld, + &channel->peer->id, + &channel->funding, + &channel->funding_txid, + &channel->remote_funding_locked); } } @@ -1516,6 +1526,16 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend, DUALOPEND_AWAITING_LOCKIN, REASON_UNKNOWN, "Sigs exchanged, waiting for lock-in"); + + /* Mimic the old behavior, notify a channel has been opened, + * for the accepter side */ + if (channel->opener == REMOTE) + /* Tell plugins about the success */ + notify_channel_opened(dualopend->ld, + &channel->peer->id, + &channel->funding, + &channel->funding_txid, + &channel->remote_funding_locked); } wallet_channel_save(ld->wallet, channel);