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.
This commit is contained in:
niftynei 2020-12-14 18:17:49 -06:00 committed by Christian Decker
parent 923e1f5c80
commit ff0e2dbd28
1 changed files with 20 additions and 0 deletions

View File

@ -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);