@@ -1183,12 +1183,6 @@ impl UnfundedChannelContext {
11831183#[derive(Clone)]
11841184pub(crate) struct PendingSpliceInfoPre {
11851185 pub our_funding_contribution: i64,
1186- // TODO(splicing): Enable below fields
1187- // pub funding_feerate_perkw: u32,
1188- // pub locktime: u32,
1189- // /// The funding inputs we will be contributing to the splice.
1190- // /// TODO(splice): will be changed to TransactionU16LenLimited
1191- // pub our_funding_inputs: Vec<(TxIn, Transaction)>,
11921186}
11931187
11941188#[cfg(splicing)]
@@ -3424,23 +3418,24 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
34243418 (context.holder_selected_channel_reserve_satoshis, context.counterparty_selected_channel_reserve_satoshis)
34253419 }
34263420
3427- /// Check that a proposed channel value meets the channel reserve requirements or violates them (below reserve)
3421+ /// Check that a balance value meets the channel reserve requirements or violates them (below reserve).
3422+ /// The channel value is an input, so that this can be used for checks with new planned channel value.
34283423 #[cfg(any(dual_funding, splicing))]
3429- pub fn check_channel_value_meets_reserve_requirements (&self, proposed_channel_value : u64) -> Result<(), ChannelError> {
3424+ pub fn check_balance_meets_reserve_requirements (&self, channel_value: u64, balance : u64) -> Result<(), ChannelError> {
34303425 let holder_selected_channel_reserve_satoshis = get_v2_channel_reserve_satoshis(
3431- proposed_channel_value , self.holder_dust_limit_satoshis);
3432- if proposed_channel_value < holder_selected_channel_reserve_satoshis {
3426+ channel_value , self.holder_dust_limit_satoshis);
3427+ if balance < holder_selected_channel_reserve_satoshis {
34333428 return Err(ChannelError::Warn(format!(
3434- "Proposed channel value below reserve mandated by holder, {} vs {}",
3435- proposed_channel_value , holder_selected_channel_reserve_satoshis,
3429+ "Balance below reserve mandated by holder, {} vs {}",
3430+ balance , holder_selected_channel_reserve_satoshis,
34363431 )));
34373432 }
34383433 let counterparty_selected_channel_reserve_satoshis = get_v2_channel_reserve_satoshis(
3439- proposed_channel_value , self.counterparty_dust_limit_satoshis);
3440- if proposed_channel_value < counterparty_selected_channel_reserve_satoshis {
3434+ channel_value , self.counterparty_dust_limit_satoshis);
3435+ if balance < counterparty_selected_channel_reserve_satoshis {
34413436 return Err(ChannelError::Warn(format!(
3442- "Proposed channel value below reserve mandated by counterparty, {} vs {}",
3443- proposed_channel_value , counterparty_selected_channel_reserve_satoshis,
3437+ "Balance below reserve mandated by counterparty, {} vs {}",
3438+ balance , counterparty_selected_channel_reserve_satoshis,
34443439 )));
34453440 }
34463441 Ok(())
@@ -3832,18 +3827,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
38323827 Ok(())
38333828 }
38343829
3835- // /// Splice process starting; update state; update capacity, state, reset funding tx
3836- // #[cfg(splicing)]
3837- // pub(crate) fn splice_start<L: Deref>(&mut self, is_outgoing: bool, logger: &L) where L::Target: Logger {
3838- // // Set state, by this point handshake is complete
3839- // self.channel_state = ChannelState::NegotiatingFunding(NegotiatingFundingFlags::OUR_INIT_SENT | NegotiatingFundingFlags::THEIR_INIT_SENT);
3840-
3841- // log_info!(logger,
3842- // "Splicing process started, new channel value {}, outgoing {}, channel_id {}",
3843- // self.channel_value_satoshis, is_outgoing, self.channel_id,
3844- // );
3845- // }
3846-
38473830 /// Get the splice message that can be sent during splice initiation.
38483831 #[cfg(splicing)]
38493832 pub fn get_splice_init(&self, our_funding_contribution_satoshis: i64,
@@ -7465,14 +7448,10 @@ impl<SP: Deref> Channel<SP> where
74657448 where ES::Target: EntropySource, L::Target: Logger
74667449 {
74677450 if !self.context.is_outbound() {
7468- // TODO(splicing): Enable starting in the line below
7469- // Apply start of splice change in the state
7470- // self.context.splice_start(false, logger);
7451+ // TODO(splicing): Apply start of splice (splice_start)
74717452
74727453 let splice_ack_msg = self.context.get_splice_ack(our_funding_contribution_satoshis)?;
74737454 // TODO(splicing): start interactive funding negotiation
7474- // let _msg = post_chan.begin_interactive_funding_tx_construction(signer_provider, entropy_source, holder_node_id)
7475- // .map_err(|err| ChannelError::Warn(format!("Failed to start interactive transaction construction, {:?}", err)))?;
74767455 Ok(splice_ack_msg)
74777456 } else {
74787457 Err(ChannelError::Warn("Internal consistency error: splice_init on inbound channel".into()))
0 commit comments