Skip to content

Commit 01760ab

Browse files
committed
Use debug_assert & error on unexpected initial commitment_signed
This replaces the hard panic from this case.
1 parent 3641bca commit 01760ab

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4055,8 +4055,11 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
40554055
{
40564056
if !matches!(
40574057
self.channel_state, ChannelState::NegotiatingFunding(flags)
4058-
if flags == (NegotiatingFundingFlags::OUR_INIT_SENT | NegotiatingFundingFlags::THEIR_INIT_SENT)) {
4059-
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)");
4058+
if flags == (NegotiatingFundingFlags::OUR_INIT_SENT | NegotiatingFundingFlags::THEIR_INIT_SENT)
4059+
) {
4060+
debug_assert!(false);
4061+
return Err(ChannelError::Ignore("Tried to get an initial commitment_signed messsage at a time other than \
4062+
immediately after initial handshake completion (or tried to get funding_created twice)".to_string()));
40604063
}
40614064
self.assert_no_commitment_advancement("initial commitment_signed");
40624065

0 commit comments

Comments
 (0)