mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-08 00:24:28 +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:
committed by
Rusty Russell
parent
d07b827050
commit
71c090745b
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user