mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-02 18:35:00 +01:00
channel: Defer sending the announcement_signature until both lock
We were sending the announcement_signatures as soon as we locally locked and got the announcement_depth, this doesn't make the channel usable any sooner and forces the other side to stash the signature. This defers the announcement_signature until the channel really is usable. This is done by adding an additional check for the remote locked message and adding a trigger on remote lock. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
d07b827050
commit
71c090745b
1 changed files with 5 additions and 1 deletions
|
@ -183,7 +183,9 @@ static void send_announcement_signatures(struct peer *peer)
|
|||
* `funding_locked` has been sent and the funding transaction has
|
||||
* at least 6 confirmations.
|
||||
*/
|
||||
if (!(peer->announce_depth_reached && peer->funding_locked[LOCAL]))
|
||||
/* Actually defer a bit further until both ends have signaled */
|
||||
if (!peer->announce_depth_reached || !peer->funding_locked[LOCAL] ||
|
||||
!peer->funding_locked[REMOTE])
|
||||
return;
|
||||
|
||||
tmpctx = tal_tmpctx(peer);
|
||||
|
@ -1692,6 +1694,8 @@ static void handle_funding_locked(struct peer *peer, const u8 *msg)
|
|||
msg_enqueue(&peer->peer_out, take(msg));
|
||||
peer->funding_locked[LOCAL] = true;
|
||||
|
||||
send_announcement_signatures(peer);
|
||||
|
||||
if (peer->funding_locked[REMOTE]) {
|
||||
wire_sync_write(MASTER_FD,
|
||||
take(towire_channel_normal_operation(peer)));
|
||||
|
|
Loading…
Add table
Reference in a new issue