Skip to content

Commit 3d12105

Browse files
jkczyzAnyitechs
authored andcommitted
Remove unnecessary next_funding check
During channel_reestablish handling, next_local_commitment_number can never be zero. Remove the unnecessary check conditioning on next_funding not being set. Additionally, remove the spec requirement in the comment that follows since it does not exist.
1 parent c9b1041 commit 3d12105

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lightning/src/ln/channel.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9157,11 +9157,10 @@ where
91579157
return Err(ChannelError::close("Peer sent a loose channel_reestablish not after reconnect".to_owned()));
91589158
}
91599159

9160-
if msg.next_local_commitment_number >= INITIAL_COMMITMENT_NUMBER || msg.next_remote_commitment_number >= INITIAL_COMMITMENT_NUMBER ||
9161-
(msg.next_local_commitment_number == 0 && msg.next_funding.is_none()) {
9162-
// Note: This also covers the following case in the V2 channel establishment specification:
9163-
// if `next_funding` is not set, and `next_commitment_number` is zero:
9164-
// MUST immediately fail the channel and broadcast any relevant latest commitment transaction.
9160+
if msg.next_local_commitment_number == 0
9161+
|| msg.next_local_commitment_number >= INITIAL_COMMITMENT_NUMBER
9162+
|| msg.next_remote_commitment_number >= INITIAL_COMMITMENT_NUMBER
9163+
{
91659164
return Err(ChannelError::close("Peer sent an invalid channel_reestablish to force close in a non-standard way".to_owned()));
91669165
}
91679166

0 commit comments

Comments
 (0)