Skip to content

Commit 8848c9a

Browse files
committed
Update next_commitment_number logic for channel_reestablish
The splicing spec updates the logic pertaining to next_commitment_number when sending a channel_reestablish message. Specifically: The sending node: - if it has sent `commitment_signed` for an interactive transaction construction but it has not received `tx_signatures`: - MUST set `next_funding_txid` to the txid of that interactive transaction. - if it has not received `commitment_signed` for that interactive transaction: - MUST set `next_commitment_number` to the commitment number of the `commitment_signed` it sent.
1 parent bbe88b6 commit 8848c9a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10168,6 +10168,19 @@ where
1016810168
self.sign_channel_announcement(node_signer, announcement).ok()
1016910169
}
1017010170

10171+
fn get_next_local_commitment_number(&self) -> u64 {
10172+
if let Some(session) = &self.interactive_tx_signing_session {
10173+
if !self.context.channel_state.is_their_tx_signatures_sent()
10174+
&& !session.has_received_commitment_signed()
10175+
{
10176+
// FIXME
10177+
return unimplemented!();
10178+
}
10179+
}
10180+
10181+
INITIAL_COMMITMENT_NUMBER - self.holder_commitment_point.transaction_number()
10182+
}
10183+
1017110184
#[rustfmt::skip]
1017210185
fn maybe_get_next_funding_txid(&self) -> Option<Txid> {
1017310186
// If we've sent `commtiment_signed` for an interactively constructed transaction
@@ -10269,7 +10282,7 @@ where
1026910282

1027010283
// next_local_commitment_number is the next commitment_signed number we expect to
1027110284
// receive (indicating if they need to resend one that we missed).
10272-
next_local_commitment_number: INITIAL_COMMITMENT_NUMBER - self.holder_commitment_point.transaction_number(),
10285+
next_local_commitment_number: self.get_next_local_commitment_number(),
1027310286
// We have to set next_remote_commitment_number to the next revoke_and_ack we expect to
1027410287
// receive, however we track it by the next commitment number for a remote transaction
1027510288
// (which is one further, as they always revoke previous commitment transaction, not

0 commit comments

Comments
 (0)