From ee9ebbc184ad9568c9d95358db3d9741c7b85c4c Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 27 Jun 2017 12:25:06 +0930 Subject: [PATCH] channeld: fix `funding_locked` retransmission using latest revision of BOLT2. Signed-off-by: Rusty Russell --- lightningd/channel/channel.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lightningd/channel/channel.c b/lightningd/channel/channel.c index 7777d8af8..809858f70 100644 --- a/lightningd/channel/channel.c +++ b/lightningd/channel/channel.c @@ -1486,11 +1486,13 @@ again: /* BOLT #2: * - * On reconnection, a node MUST retransmit `funding_locked` unless it - * has received an `update_` or `revoke_and_ack` for that channel, - * otherwise it MAY retransmit `funding_locked`. + * If `next_local_commitment_number` is 1 in both the + * `channel_reestablish` it sent and received, then the node MUST + * retransmit `funding_locked`, otherwise it MUST NOT. */ - if (peer->funding_locked[LOCAL]) { + if (peer->funding_locked[LOCAL] + && peer->next_index[LOCAL] == 1 + && next_local_commitment_number == 1) { u8 *msg; struct pubkey next_per_commit_point;