@@ -8219,10 +8219,11 @@ impl<SP: Deref> FundedChannel<SP> where
82198219 }
82208220
82218221 /// Initiate splicing.
8222- /// - witness_weight: The witness weight for contributed inputs.
8222+ /// - our_funding_inputs: the inputs we contribute to the new funding transaction.
8223+ /// Includes the witness weight for this input (e.g. P2WPKH_WITNESS_WEIGHT=109 for typical P2WPKH inputs).
82238224 #[cfg(splicing)]
82248225 pub fn splice_channel(&mut self, our_funding_contribution_satoshis: i64,
8225- our_funding_inputs: Vec<(TxIn, Transaction)>, witness_weight: Weight,
8226+ our_funding_inputs: Vec<(TxIn, Transaction, Weight)> ,
82268227 funding_feerate_per_kw: u32, locktime: u32,
82278228 ) -> Result<msgs::SpliceInit, ChannelError> {
82288229 // Check if a splice has been initiated already.
@@ -8261,14 +8262,15 @@ impl<SP: Deref> FundedChannel<SP> where
82618262 // Pre-check that inputs are sufficient to cover our contribution.
82628263 // Note: fees are not taken into account here.
82638264 let sum_input: u64 = our_funding_inputs.iter().map(
8264- |(txin, tx)| tx.output.get(txin.previous_output.vout as usize).map(|tx| tx.value.to_sat()).unwrap_or(0)
8265+ |(txin, tx, _ )| tx.output.get(txin.previous_output.vout as usize).map(|tx| tx.value.to_sat()).unwrap_or(0)
82658266 ).sum();
82668267
82678268 // The +1 is to include the input of the old funding
82688269 let funding_input_count = our_funding_inputs.len() + 1;
82698270 // Input witness weight, extended with weight for spending old funding
82708271 let total_witness_weight = Weight::from_wu(
8271- witness_weight.to_wu().saturating_add(FUNDING_TRANSACTION_WITNESS_WEIGHT)
8272+ our_funding_inputs.iter().map(|(_, _, w)| w.to_wu()).sum::<u64>()
8273+ .saturating_add(FUNDING_TRANSACTION_WITNESS_WEIGHT)
82728274 );
82738275 let estimated_fee = estimate_funding_transaction_fee(true, funding_input_count, total_witness_weight, funding_feerate_per_kw);
82748276 let available_input = sum_input.saturating_sub(estimated_fee);
@@ -9504,6 +9506,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
95049506
95059507 /// Creates a new dual-funded channel from a remote side's request for one.
95069508 /// Assumes chain_hash has already been checked and corresponds with what we expect!
9509+ /// TODO(dual_funding): Include witness weight info with the inputs.
95079510 #[allow(dead_code)] // TODO(dual_funding): Remove once V2 channels is enabled.
95089511 pub fn new_inbound<ES: Deref, F: Deref, L: Deref>(
95099512 fee_estimator: &LowerBoundedFeeEstimator<F>, entropy_source: &ES, signer_provider: &SP,
0 commit comments