Skip to content

Commit 6cb8084

Browse files
committed
fix Two minor error handling changes; expect instead of if
1 parent eb828be commit 6cb8084

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lightning/src/ln/channel.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,7 @@ where
17391739
ChannelPhase::UnfundedV2(chan) => Ok(chan.as_negotiating_channel()),
17401740
#[cfg(splicing)]
17411741
ChannelPhase::Funded(chan) => {
1742-
Ok(chan.as_renegotiating_channel().map_err(|err| ChannelError::Warn(err.into()))?)
1742+
chan.as_renegotiating_channel().map_err(|err| ChannelError::Warn(err.into()))
17431743
},
17441744
_ => Err(ChannelError::Warn(
17451745
"Got a transaction negotiation message in an invalid phase".to_owned(),
@@ -1787,9 +1787,7 @@ where
17871787
{
17881788
let logger = WithChannelContext::from(logger, self.context(), None);
17891789
let mut negotiating_channel = self.as_negotiating_channel()?;
1790-
let (commitment_signed, event) =
1791-
negotiating_channel.funding_tx_constructed(signing_session, &&logger)?;
1792-
Ok((commitment_signed, event))
1790+
negotiating_channel.funding_tx_constructed(signing_session, &&logger)
17931791
}
17941792

17951793
pub fn force_shutdown(&mut self, closure_reason: ClosureReason) -> ShutdownResult {
@@ -2219,11 +2217,9 @@ impl FundingScope {
22192217
channel_type_features: channel_parameters.channel_type_features.clone(),
22202218
channel_value_satoshis: post_channel_value,
22212219
};
2222-
if let Some(ref mut counterparty_parameters) =
2223-
post_channel_transaction_parameters.counterparty_parameters
2224-
{
2225-
counterparty_parameters.pubkeys.funding_pubkey = counterparty_funding_pubkey;
2226-
}
2220+
post_channel_transaction_parameters.counterparty_parameters.as_mut()
2221+
.expect("Expecting counterparty_parameters to be set on post_channel_transaction_parameters in FundingScope::for_splice()")
2222+
.pubkeys.funding_pubkey = counterparty_funding_pubkey;
22272223

22282224
// New reserve values are based on the new channel value, and v2-specific
22292225
let counterparty_selected_channel_reserve_satoshis = Some(get_v2_channel_reserve_satoshis(

0 commit comments

Comments
 (0)