Skip to content

Commit 9363bcc

Browse files
committed
Replace panic with debug_assert & error when receiving initial commitment_signed at unexpected time
1 parent d593cc0 commit 9363bcc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lightning/src/ln/channel.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -4047,8 +4047,11 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
40474047
{
40484048
if !matches!(
40494049
self.channel_state, ChannelState::NegotiatingFunding(flags)
4050-
if flags == (NegotiatingFundingFlags::OUR_INIT_SENT | NegotiatingFundingFlags::THEIR_INIT_SENT)) {
4051-
panic!("Tried to get an initial commitment_signed messsage at a time other than immediately after initial handshake completion (or tried to get funding_created twice)");
4050+
if flags == (NegotiatingFundingFlags::OUR_INIT_SENT | NegotiatingFundingFlags::THEIR_INIT_SENT)
4051+
) {
4052+
debug_assert!(false);
4053+
return Err(ChannelError::Ignore("Tried to get an initial commitment_signed messsage at a time other than \
4054+
immediately after initial handshake completion (or tried to get funding_created twice)".to_string()));
40524055
}
40534056
self.assert_no_commitment_advancement("initial commitment_signed");
40544057

0 commit comments

Comments
 (0)