@@ -1781,13 +1781,10 @@ where
1781
1781
L::Target: Logger,
1782
1782
{
1783
1783
let logger = WithChannelContext::from(logger, self.context(), None);
1784
- if let Ok(mut negotiating_channel) = self.as_negotiating_channel() {
1785
- let (commitment_signed, event) =
1786
- negotiating_channel.funding_tx_constructed(signing_session, &&logger)?;
1787
- Ok((commitment_signed, event))
1788
- } else {
1789
- Err(ChannelError::Warn("Got a tx_complete message with no interactive transaction construction expected or in-progress".to_owned()))
1790
- }
1784
+ let mut negotiating_channel = self.as_negotiating_channel()?;
1785
+ let (commitment_signed, event) =
1786
+ negotiating_channel.funding_tx_constructed(signing_session, &&logger)?;
1787
+ Ok((commitment_signed, event))
1791
1788
}
1792
1789
1793
1790
pub fn force_shutdown(
@@ -2171,45 +2168,26 @@ impl FundingScope {
2171
2168
{
2172
2169
let post_value_to_self_msat_signed = (prev_funding.value_to_self_msat as i64)
2173
2170
.saturating_add(our_funding_contribution_sats * 1000);
2174
- if post_value_to_self_msat_signed < 0 {
2175
- // Splice out and more than our balance, error
2176
- return Err(ChannelError::Warn(format!(
2177
- "Cannot splice out more than the current balance, {} sats, {} msats",
2178
- post_value_to_self_msat_signed, prev_funding.value_to_self_msat
2179
- )));
2180
- }
2181
2171
debug_assert!(post_value_to_self_msat_signed >= 0);
2182
2172
let post_value_to_self_msat = post_value_to_self_msat_signed as u64;
2183
2173
2184
- let prev_funding_txid = prev_funding
2185
- .channel_transaction_parameters
2186
- .funding_outpoint
2187
- .map(|outpoint| outpoint.txid);
2174
+ let prev_funding_txid = prev_funding.get_funding_txid();
2188
2175
let holder_pubkeys = match &context.holder_signer {
2189
2176
ChannelSignerType::Ecdsa(ecdsa) => ecdsa.pubkeys(prev_funding_txid, &context.secp_ctx),
2190
2177
// TODO (taproot|arik)
2191
2178
#[cfg(taproot)]
2192
2179
_ => todo!(),
2193
2180
};
2181
+ let channel_parameters = &prev_funding.channel_transaction_parameters;
2194
2182
let mut post_channel_transaction_parameters = ChannelTransactionParameters {
2195
2183
holder_pubkeys,
2196
- holder_selected_contest_delay: prev_funding
2197
- .channel_transaction_parameters
2198
- .holder_selected_contest_delay,
2184
+ holder_selected_contest_delay: channel_parameters.holder_selected_contest_delay,
2199
2185
// The 'outbound' attribute doesn't change, even if the splice initiator is the other node
2200
- is_outbound_from_holder: prev_funding
2201
- .channel_transaction_parameters
2202
- .is_outbound_from_holder,
2203
- counterparty_parameters: prev_funding
2204
- .channel_transaction_parameters
2205
- .counterparty_parameters
2206
- .clone(),
2186
+ is_outbound_from_holder: channel_parameters.is_outbound_from_holder,
2187
+ counterparty_parameters: channel_parameters.counterparty_parameters.clone(),
2207
2188
funding_outpoint: None, // filled later
2208
2189
splice_parent_funding_txid: prev_funding_txid,
2209
- channel_type_features: prev_funding
2210
- .channel_transaction_parameters
2211
- .channel_type_features
2212
- .clone(),
2190
+ channel_type_features: channel_parameters.channel_type_features.clone(),
2213
2191
channel_value_satoshis: post_channel_value,
2214
2192
};
2215
2193
// Update the splicing 'tweak', this will rotate the keys in the signer
@@ -2870,7 +2848,7 @@ where
2870
2848
/// Can be produced by:
2871
2849
/// - [`PendingV2Channel`], at V2 channel open, and
2872
2850
/// - [`FundedChannel`], when splicing.
2873
- pub struct NegotiatingChannelView<'a, SP: Deref>
2851
+ pub(super) struct NegotiatingChannelView<'a, SP: Deref>
2874
2852
where
2875
2853
SP::Target: SignerProvider,
2876
2854
{
0 commit comments