Skip to content

Commit fd4d052

Browse files
committed
Avoid initial commitment channel_ready retransmission while splicing
If nodes have started a splice, this means they have both sent and received `channel_ready` already: in that case, it's unnecessary to retransmit `channel_ready` on reconnection.
1 parent 1f3c519 commit fd4d052

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lightning/src/ln/channel.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9693,12 +9693,18 @@ where
96939693

96949694
// A node:
96959695
// - if `next_commitment_number` is 1 in both the `channel_reestablish` it
9696-
// sent and received:
9696+
// sent and received, and none of those `channel_reestablish` messages
9697+
// contain `my_current_funding_locked` or `next_funding` for a splice transaction:
96979698
// - MUST retransmit `channel_ready`.
96989699
// - otherwise:
96999700
// - MUST NOT retransmit `channel_ready`, but MAY send `channel_ready` with
97009701
// a different `short_channel_id` `alias` field.
9701-
let channel_ready = if msg.next_local_commitment_number == 1 && INITIAL_COMMITMENT_NUMBER - self.holder_commitment_point.next_transaction_number() == 1 {
9702+
let both_sides_on_initial_commitment_number = msg.next_local_commitment_number == 1
9703+
&& INITIAL_COMMITMENT_NUMBER - self.holder_commitment_point.next_transaction_number() == 1;
9704+
let channel_ready = if both_sides_on_initial_commitment_number
9705+
&& self.pending_splice.is_none()
9706+
&& self.funding.channel_transaction_parameters.splice_parent_funding_txid.is_none()
9707+
{
97029708
// We should never have to worry about MonitorUpdateInProgress resending ChannelReady
97039709
self.get_channel_ready(logger)
97049710
} else { None };

lightning/src/ln/splicing_tests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,6 @@ fn do_test_splice_state_reset_on_disconnect(reload: bool) {
497497
}
498498

499499
let mut reconnect_args = ReconnectArgs::new(&nodes[0], &nodes[1]);
500-
reconnect_args.send_channel_ready = (true, true);
501500
reconnect_nodes(reconnect_args);
502501

503502
mine_transaction(&nodes[0], &splice_tx);

0 commit comments

Comments
 (0)