Browse Source

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>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
71c090745b
  1. 6
      channeld/channel.c

6
channeld/channel.c

@ -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…
Cancel
Save