@@ -1722,7 +1722,7 @@ impl FundingScope {
17221722/// Info about a pending splice, used in the pre-splice channel
17231723#[cfg(splicing)]
17241724#[derive(Clone)]
1725- struct PendingSpliceInfoPre {
1725+ struct PendingSplice {
17261726 pub our_funding_contribution: i64,
17271727 pub funding_feerate_perkw: u32,
17281728 pub locktime: u32,
@@ -1731,7 +1731,7 @@ struct PendingSpliceInfoPre {
17311731}
17321732
17331733#[cfg(splicing)]
1734- impl PendingSpliceInfoPre {
1734+ impl PendingSplice {
17351735 #[inline]
17361736 fn add_checked(base: u64, delta: i64) -> u64 {
17371737 if delta >= 0 {
@@ -4737,18 +4737,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
47374737 self.get_initial_counterparty_commitment_signature(funding, logger)
47384738 }
47394739
4740- /// Splice process starting; update state, log, etc.
4741- #[cfg(splicing)]
4742- pub(crate) fn splice_start<L: Deref>(&mut self, is_outgoing: bool, logger: &L) where L::Target: Logger {
4743- // Set state, by this point splice_init/splice_ack handshake is complete
4744- // TODO(splicing)
4745- // self.channel_state = ChannelState::NegotiatingFunding(
4746- // NegotiatingFundingFlags::OUR_INIT_SENT | NegotiatingFundingFlags::THEIR_INIT_SENT
4747- // );
4748- log_info!(logger, "Splicing process started, old channel value {}, outgoing {}, channel_id {}",
4749- self.channel_value_satoshis, is_outgoing, self.channel_id);
4750- }
4751-
47524740 /// Get the splice message that can be sent during splice initiation.
47534741 #[cfg(splicing)]
47544742 pub fn get_splice_init(&self, our_funding_contribution_satoshis: i64,
@@ -4902,7 +4890,7 @@ pub(super) struct FundedChannel<SP: Deref> where SP::Target: SignerProvider {
49024890 is_v2_established: bool,
49034891 /// Info about an in-progress, pending splice (if any), on the pre-splice channel
49044892 #[cfg(splicing)]
4905- pending_splice_pre: Option<PendingSpliceInfoPre >,
4893+ pending_splice_pre: Option<PendingSplice >,
49064894}
49074895
49084896#[cfg(any(test, fuzzing))]
@@ -8582,7 +8570,7 @@ impl<SP: Deref> FundedChannel<SP> where
85828570 )));
85838571 }
85848572
8585- self.pending_splice_pre = Some(PendingSpliceInfoPre {
8573+ self.pending_splice_pre = Some(PendingSplice {
85868574 our_funding_contribution: our_funding_contribution_satoshis,
85878575 funding_feerate_perkw,
85888576 locktime,
@@ -8633,16 +8621,16 @@ impl<SP: Deref> FundedChannel<SP> where
86338621 )));
86348622 }
86358623
8636- let post_channel_value = PendingSpliceInfoPre ::compute_post_value(pre_channel_value, their_funding_contribution_satoshis, our_funding_contribution_satoshis);
8637- let post_balance = PendingSpliceInfoPre ::add_checked(self.funding.value_to_self_msat, our_funding_contribution_satoshis);
8624+ let post_channel_value = PendingSplice ::compute_post_value(pre_channel_value, their_funding_contribution_satoshis, our_funding_contribution_satoshis);
8625+ let post_balance = PendingSplice ::add_checked(self.funding.value_to_self_msat, our_funding_contribution_satoshis);
86388626 // Early check for reserve requirement, assuming maximum balance of full channel value
86398627 // This will also be checked later at tx_complete
86408628 let _res = self.context.check_balance_meets_reserve_requirements(post_balance, post_channel_value)?;
86418629
86428630 // TODO(splicing): Store msg.funding_pubkey
86438631
86448632 // Apply start of splice change in the state
8645- self.context. splice_start(false, logger);
8633+ self.splice_start(false, logger);
86468634
86478635 let splice_ack_msg = self.context.get_splice_ack(our_funding_contribution_satoshis);
86488636
@@ -8670,14 +8658,14 @@ impl<SP: Deref> FundedChannel<SP> where
86708658 let our_funding_contribution = pending_splice.our_funding_contribution;
86718659
86728660 let pre_channel_value = self.funding.get_value_satoshis();
8673- let post_channel_value = PendingSpliceInfoPre ::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution_satoshis);
8674- let post_balance = PendingSpliceInfoPre ::add_checked(self.funding.value_to_self_msat, our_funding_contribution);
8661+ let post_channel_value = PendingSplice ::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution_satoshis);
8662+ let post_balance = PendingSplice ::add_checked(self.funding.value_to_self_msat, our_funding_contribution);
86758663 // Early check for reserve requirement, assuming maximum balance of full channel value
86768664 // This will also be checked later at tx_complete
86778665 let _res = self.context.check_balance_meets_reserve_requirements(post_balance, post_channel_value)?;
86788666
86798667 // Apply start of splice change in the state
8680- self.context. splice_start(true, logger);
8668+ self.splice_start(true, logger);
86818669
86828670 // TODO(splicing): start interactive funding negotiation
86838671 // let tx_msg_opt = self.begin_interactive_funding_tx_construction(signer_provider, entropy_source, holder_node_id)
@@ -8686,6 +8674,18 @@ impl<SP: Deref> FundedChannel<SP> where
86868674 Ok(None)
86878675 }
86888676
8677+ /// Splice process starting; update state, log, etc.
8678+ #[cfg(splicing)]
8679+ pub(crate) fn splice_start<L: Deref>(&mut self, is_outgoing: bool, logger: &L) where L::Target: Logger {
8680+ // Set state, by this point splice_init/splice_ack handshake is complete
8681+ // TODO(splicing)
8682+ // self.channel_state = ChannelState::NegotiatingFunding(
8683+ // NegotiatingFundingFlags::OUR_INIT_SENT | NegotiatingFundingFlags::THEIR_INIT_SENT
8684+ // );
8685+ log_info!(logger, "Splicing process started, old channel value {}, outgoing {}, channel_id {}",
8686+ self.funding.channel_value_satoshis, is_outgoing, self.context.channel_id);
8687+ }
8688+
86898689 // Send stuff to our remote peers:
86908690
86918691 /// Queues up an outbound HTLC to send by placing it in the holding cell. You should call
@@ -13057,9 +13057,9 @@ mod tests {
1305713057
1305813058 #[cfg(all(test, splicing))]
1305913059 fn get_pre_and_post(pre_channel_value: u64, our_funding_contribution: i64, their_funding_contribution: i64) -> (u64, u64) {
13060- use crate::ln::channel::PendingSpliceInfoPre ;
13060+ use crate::ln::channel::PendingSplice ;
1306113061
13062- let post_channel_value = PendingSpliceInfoPre ::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution);
13062+ let post_channel_value = PendingSplice ::compute_post_value(pre_channel_value, our_funding_contribution, their_funding_contribution);
1306313063 (pre_channel_value, post_channel_value)
1306413064 }
1306513065
0 commit comments