Skip to content

Commit 976381a

Browse files
committed
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 77747c0 commit 976381a

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
@@ -9120,11 +9120,10 @@ where
91209120
return Err(ChannelError::close("Peer sent a loose channel_reestablish not after reconnect".to_owned()));
91219121
}
91229122

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

0 commit comments

Comments
 (0)