From 71c090745b3391837ca67ba83e91531a3a1e2d19 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 13 Nov 2017 21:52:37 +0100 Subject: [PATCH] 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 --- channeld/channel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/channeld/channel.c b/channeld/channel.c index 76156317f..d5be2260c 100644 --- a/channeld/channel.c +++ b/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)));