Skip to content

Commit cabd6be

Browse files
committed
fix Simplification in funding_tx_constructed, use as_negotiating_channel
1 parent 0d7a9b4 commit cabd6be

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

lightning/src/ln/channel.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,23 +1631,12 @@ impl<SP: Deref> Channel<SP> where
16311631
where
16321632
L::Target: Logger
16331633
{
1634-
match self.phase {
1635-
ChannelPhase::UnfundedV2(ref mut chan) => {
1636-
let logger = WithChannelContext::from(logger, &chan.context, None);
1637-
let (commitment_signed, event) = chan.as_negotiating_channel().funding_tx_constructed(signing_session, &&logger)?;
1638-
Ok((commitment_signed, event))
1639-
}
1640-
#[cfg(splicing)]
1641-
ChannelPhase::Funded(ref mut chan) => {
1642-
let logger = WithChannelContext::from(logger, &chan.context, None);
1643-
let (commitment_signed, event) = chan.as_renegotiating_channel()
1644-
.map_err(|err| ChannelError::Warn(err.into()))?
1645-
.funding_tx_constructed(signing_session, &&logger)?;
1646-
Ok((commitment_signed, event))
1647-
}
1648-
_ => {
1649-
Err(ChannelError::Warn("Got a tx_complete message with no interactive transaction construction expected or in-progress".to_owned()))
1650-
}
1634+
let logger = WithChannelContext::from(logger, self.context(), None);
1635+
if let Ok(mut negotiating_channel) = self.as_negotiating_channel() {
1636+
let (commitment_signed, event) = negotiating_channel.funding_tx_constructed(signing_session, &&logger)?;
1637+
Ok((commitment_signed, event))
1638+
} else {
1639+
Err(ChannelError::Warn("Got a tx_complete message with no interactive transaction construction expected or in-progress".to_owned()))
16511640
}
16521641
}
16531642

0 commit comments

Comments
 (0)