@@ -1183,12 +1183,6 @@ impl UnfundedChannelContext {
1183
1183
#[derive(Clone)]
1184
1184
pub(crate) struct PendingSpliceInfoPre {
1185
1185
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)>,
1192
1186
}
1193
1187
1194
1188
#[cfg(splicing)]
@@ -3424,23 +3418,24 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3424
3418
(context.holder_selected_channel_reserve_satoshis, context.counterparty_selected_channel_reserve_satoshis)
3425
3419
}
3426
3420
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.
3428
3423
#[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> {
3430
3425
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 {
3433
3428
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,
3436
3431
)));
3437
3432
}
3438
3433
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 {
3441
3436
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,
3444
3439
)));
3445
3440
}
3446
3441
Ok(())
@@ -3832,18 +3827,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
3832
3827
Ok(())
3833
3828
}
3834
3829
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
-
3847
3830
/// Get the splice message that can be sent during splice initiation.
3848
3831
#[cfg(splicing)]
3849
3832
pub fn get_splice_init(&self, our_funding_contribution_satoshis: i64,
@@ -7465,14 +7448,10 @@ impl<SP: Deref> Channel<SP> where
7465
7448
where ES::Target: EntropySource, L::Target: Logger
7466
7449
{
7467
7450
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)
7471
7452
7472
7453
let splice_ack_msg = self.context.get_splice_ack(our_funding_contribution_satoshis)?;
7473
7454
// 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)))?;
7476
7455
Ok(splice_ack_msg)
7477
7456
} else {
7478
7457
Err(ChannelError::Warn("Internal consistency error: splice_init on inbound channel".into()))
0 commit comments