@@ -6024,7 +6024,9 @@ impl FundingNegotiationContext {
6024
6024
};
6025
6025
6026
6026
let (inputs_to_contribute, change_script) = match self.funding_tx_contributions {
6027
- FundingTxContributions::InputsOnly { inputs, change_script } => (inputs, change_script),
6027
+ FundingTxContributions::InputsOnly { inputs, change_script } => {
6028
+ (inputs.into_iter().map(|(txin, tx, _)| (txin, tx)).collect(), change_script)
6029
+ },
6028
6030
};
6029
6031
6030
6032
// Add change output if necessary
@@ -6078,7 +6080,7 @@ pub enum FundingTxContributions {
6078
6080
InputsOnly {
6079
6081
/// The inputs used to meet the contributed amount. Any excess amount will be sent to a
6080
6082
/// change output.
6081
- inputs: Vec<(TxIn, Transaction)>,
6083
+ inputs: Vec<(TxIn, Transaction, Weight )>,
6082
6084
6083
6085
/// An optional change output script. This will be used if needed or, if not set, generated
6084
6086
/// using `SignerProvider::get_destination_script`.
@@ -6088,7 +6090,7 @@ pub enum FundingTxContributions {
6088
6090
6089
6091
impl FundingTxContributions {
6090
6092
/// Returns an inputs to be contributed to the funding transaction.
6091
- pub fn inputs(&self) -> &[(TxIn, Transaction)] {
6093
+ pub fn inputs(&self) -> &[(TxIn, Transaction, Weight )] {
6092
6094
match self {
6093
6095
FundingTxContributions::InputsOnly { inputs, .. } => &inputs[..],
6094
6096
}
@@ -10700,9 +10702,8 @@ where
10700
10702
err,
10701
10703
),
10702
10704
})?;
10703
- // Convert inputs
10704
- let mut funding_inputs = Vec::new();
10705
- for (txin, tx, _) in our_funding_inputs.into_iter() {
10705
+
10706
+ for (_, tx, _) in our_funding_inputs.iter() {
10706
10707
const MESSAGE_TEMPLATE: msgs::TxAddInput = msgs::TxAddInput {
10707
10708
channel_id: ChannelId([0; 32]),
10708
10709
serial_id: 0,
@@ -10717,12 +10718,10 @@ where
10717
10718
err: format!("Funding input's prevtx is too large for tx_add_input"),
10718
10719
});
10719
10720
}
10720
-
10721
- funding_inputs.push((txin, tx));
10722
10721
}
10723
10722
10724
10723
let funding_tx_contributions =
10725
- FundingTxContributions::InputsOnly { inputs: funding_inputs , change_script };
10724
+ FundingTxContributions::InputsOnly { inputs: our_funding_inputs , change_script };
10726
10725
10727
10726
let prev_funding_input = self.funding.to_splice_funding_input();
10728
10727
let funding_negotiation_context = FundingNegotiationContext {
@@ -12499,7 +12498,7 @@ where
12499
12498
pub fn new_outbound<ES: Deref, F: Deref, L: Deref>(
12500
12499
fee_estimator: &LowerBoundedFeeEstimator<F>, entropy_source: &ES, signer_provider: &SP,
12501
12500
counterparty_node_id: PublicKey, their_features: &InitFeatures, funding_satoshis: u64,
12502
- funding_inputs: Vec<(TxIn, Transaction)>, user_id: u128, config: &UserConfig,
12501
+ funding_inputs: Vec<(TxIn, Transaction, Weight )>, user_id: u128, config: &UserConfig,
12503
12502
current_chain_height: u32, outbound_scid_alias: u64, funding_confirmation_target: ConfirmationTarget,
12504
12503
logger: L,
12505
12504
) -> Result<Self, APIError>
@@ -12660,7 +12659,7 @@ where
12660
12659
{
12661
12660
// TODO(dual_funding): Take these as input once supported
12662
12661
let (our_funding_contribution, our_funding_contribution_sats) = (SignedAmount::ZERO, 0u64);
12663
- let our_funding_inputs = Vec::new();
12662
+ let our_funding_inputs: Vec<(TxIn, Transaction, Weight)> = Vec::new();
12664
12663
12665
12664
let channel_value_satoshis =
12666
12665
our_funding_contribution_sats.saturating_add(msg.common_fields.funding_satoshis);
@@ -12729,7 +12728,7 @@ where
12729
12728
feerate_sat_per_kw: funding_negotiation_context.funding_feerate_sat_per_1000_weight,
12730
12729
funding_tx_locktime: funding_negotiation_context.funding_tx_locktime,
12731
12730
is_initiator: false,
12732
- inputs_to_contribute: our_funding_inputs,
12731
+ inputs_to_contribute: our_funding_inputs.into_iter().map(|(txin, tx, _)| (txin, tx)).collect() ,
12733
12732
shared_funding_input: None,
12734
12733
shared_funding_output: SharedOwnedOutput::new(shared_funding_output, our_funding_contribution_sats),
12735
12734
outputs_to_contribute: Vec::new(),
0 commit comments