Skip to content

Commit d9314a2

Browse files
committed
fix Two minor error handling changes; expect instead of if
1 parent 74d4a14 commit d9314a2

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
@@ -1736,7 +1736,7 @@ where
17361736
ChannelPhase::UnfundedV2(chan) => Ok(chan.as_negotiating_channel()),
17371737
#[cfg(splicing)]
17381738
ChannelPhase::Funded(chan) => {
1739-
Ok(chan.as_renegotiating_channel().map_err(|err| ChannelError::Warn(err.into()))?)
1739+
chan.as_renegotiating_channel().map_err(|err| ChannelError::Warn(err.into()))
17401740
},
17411741
_ => Err(ChannelError::Warn(
17421742
"Got a transaction negotiation message in an invalid phase".to_owned(),
@@ -1784,9 +1784,7 @@ where
17841784
{
17851785
let logger = WithChannelContext::from(logger, self.context(), None);
17861786
let mut negotiating_channel = self.as_negotiating_channel()?;
1787-
let (commitment_signed, event) =
1788-
negotiating_channel.funding_tx_constructed(signing_session, &&logger)?;
1789-
Ok((commitment_signed, event))
1787+
negotiating_channel.funding_tx_constructed(signing_session, &&logger)
17901788
}
17911789

17921790
pub fn force_shutdown(
@@ -2218,11 +2216,9 @@ impl FundingScope {
22182216
channel_type_features: channel_parameters.channel_type_features.clone(),
22192217
channel_value_satoshis: post_channel_value,
22202218
};
2221-
if let Some(ref mut counterparty_parameters) =
2222-
post_channel_transaction_parameters.counterparty_parameters
2223-
{
2224-
counterparty_parameters.pubkeys.funding_pubkey = counterparty_funding_pubkey;
2225-
}
2219+
post_channel_transaction_parameters.counterparty_parameters.as_mut()
2220+
.expect("Expecting counterparty_parameters to be set on post_channel_transaction_parameters in FundingScope::for_splice()")
2221+
.pubkeys.funding_pubkey = counterparty_funding_pubkey;
22262222

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

0 commit comments

Comments
 (0)