@@ -1722,7 +1722,7 @@ impl FundingScope {
1722
1722
/// Info about a pending splice, used in the pre-splice channel
1723
1723
#[cfg(splicing)]
1724
1724
#[derive(Clone)]
1725
- struct PendingSpliceInfoPre {
1725
+ struct PendingSplice {
1726
1726
pub our_funding_contribution: i64,
1727
1727
pub funding_feerate_perkw: u32,
1728
1728
pub locktime: u32,
@@ -1731,7 +1731,7 @@ struct PendingSpliceInfoPre {
1731
1731
}
1732
1732
1733
1733
#[cfg(splicing)]
1734
- impl PendingSpliceInfoPre {
1734
+ impl PendingSplice {
1735
1735
#[inline]
1736
1736
fn add_checked(base: u64, delta: i64) -> u64 {
1737
1737
if delta >= 0 {
@@ -4737,18 +4737,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
4737
4737
self.get_initial_counterparty_commitment_signature(funding, logger)
4738
4738
}
4739
4739
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
-
4752
4740
/// Get the splice message that can be sent during splice initiation.
4753
4741
#[cfg(splicing)]
4754
4742
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 {
4902
4890
is_v2_established: bool,
4903
4891
/// Info about an in-progress, pending splice (if any), on the pre-splice channel
4904
4892
#[cfg(splicing)]
4905
- pending_splice_pre: Option<PendingSpliceInfoPre >,
4893
+ pending_splice_pre: Option<PendingSplice >,
4906
4894
}
4907
4895
4908
4896
#[cfg(any(test, fuzzing))]
@@ -8582,7 +8570,7 @@ impl<SP: Deref> FundedChannel<SP> where
8582
8570
)));
8583
8571
}
8584
8572
8585
- self.pending_splice_pre = Some(PendingSpliceInfoPre {
8573
+ self.pending_splice_pre = Some(PendingSplice {
8586
8574
our_funding_contribution: our_funding_contribution_satoshis,
8587
8575
funding_feerate_perkw,
8588
8576
locktime,
@@ -8633,16 +8621,16 @@ impl<SP: Deref> FundedChannel<SP> where
8633
8621
)));
8634
8622
}
8635
8623
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);
8638
8626
// Early check for reserve requirement, assuming maximum balance of full channel value
8639
8627
// This will also be checked later at tx_complete
8640
8628
let _res = self.context.check_balance_meets_reserve_requirements(post_balance, post_channel_value)?;
8641
8629
8642
8630
// TODO(splicing): Store msg.funding_pubkey
8643
8631
8644
8632
// Apply start of splice change in the state
8645
- self.context. splice_start(false, logger);
8633
+ self.splice_start(false, logger);
8646
8634
8647
8635
let splice_ack_msg = self.context.get_splice_ack(our_funding_contribution_satoshis);
8648
8636
@@ -8670,14 +8658,14 @@ impl<SP: Deref> FundedChannel<SP> where
8670
8658
let our_funding_contribution = pending_splice.our_funding_contribution;
8671
8659
8672
8660
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);
8675
8663
// Early check for reserve requirement, assuming maximum balance of full channel value
8676
8664
// This will also be checked later at tx_complete
8677
8665
let _res = self.context.check_balance_meets_reserve_requirements(post_balance, post_channel_value)?;
8678
8666
8679
8667
// Apply start of splice change in the state
8680
- self.context. splice_start(true, logger);
8668
+ self.splice_start(true, logger);
8681
8669
8682
8670
// TODO(splicing): start interactive funding negotiation
8683
8671
// 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
8686
8674
Ok(None)
8687
8675
}
8688
8676
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
+
8689
8689
// Send stuff to our remote peers:
8690
8690
8691
8691
/// Queues up an outbound HTLC to send by placing it in the holding cell. You should call
@@ -13057,9 +13057,9 @@ mod tests {
13057
13057
13058
13058
#[cfg(all(test, splicing))]
13059
13059
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 ;
13061
13061
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);
13063
13063
(pre_channel_value, post_channel_value)
13064
13064
}
13065
13065
0 commit comments