Skip to content

Commit 01a8d2b

Browse files
committed
lightningd: send announcement_signatures once channel is ready, don't wait until 6 deep.
The spec used to say you had to wait for channel to be ready, *and* 6 depth before exchanging signatures. Now the 6 depth requirement is only on the actual announcing of the channel: you can send sigs any time. This means our state machine goes from: NOT_USABLE -> NOT_DEEP_ENOUGH -> NEED_PEER_SIGS -> ANNOUNCED to: NOT_USABLE -> NEED_PEER_SIGS -> NOT_DEEP_ENOUGH -> ANNOUNCED However, this revealed that our state machine is insufficient, so rework it to be more general and understandable. In particular, check for unexpected state transitions, and thus document them. Note that cg->sent_sigs replaces channel->replied_to_announcement_sigs, too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Changed: Protocol: We now exchange `announcement_signatures` as soon as we're ready, rather than waiting for 6 blocks (as per recent BOLT update)
1 parent 167767d commit 01a8d2b

File tree

5 files changed

+561
-264
lines changed

5 files changed

+561
-264
lines changed

lightningd/channel.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ struct channel *new_unsaved_channel(struct peer *peer,
322322
/* Nothing happened yet */
323323
memset(&channel->stats, 0, sizeof(channel->stats));
324324
channel->state_changes = tal_arr(channel, struct channel_state_change *, 0);
325-
channel->replied_to_announcement_sigs = false;
326325

327326
/* No shachain yet */
328327
channel->their_shachain.id = 0;
@@ -633,7 +632,6 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
633632
channel->num_onchain_spent_calls = 0;
634633
channel->stats = *stats;
635634
channel->state_changes = tal_steal(channel, state_changes);
636-
channel->replied_to_announcement_sigs = false;
637635

638636
/* Populate channel->channel_gossip */
639637
channel_gossip_init(channel, take(peer_update));

lightningd/channel.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,6 @@ struct channel {
353353

354354
/* Our change history. */
355355
struct channel_state_change **state_changes;
356-
357-
/* Have we replied to announcement_signatures once? */
358-
bool replied_to_announcement_sigs;
359356
};
360357

361358
/* Is channel owned (and should be talking to peer) */

0 commit comments

Comments
 (0)