Skip to content

Commit

Permalink
Rename extra_input to prev_funding_input
Browse files Browse the repository at this point in the history
  • Loading branch information
optout21 committed Dec 11, 2024
1 parent d882704 commit b4f1fbf
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1692,29 +1692,29 @@ pub(super) trait InteractivelyFunded<SP: Deref> where SP::Target: SignerProvider
#[allow(dead_code)] // TODO(dual_funding): Remove once contribution to V2 channels is enabled
fn begin_interactive_funding_tx_construction<ES: Deref>(
&mut self, signer_provider: &SP, entropy_source: &ES, holder_node_id: PublicKey,
extra_input: Option<(TxIn, TransactionU16LenLimited)>,
prev_funding_input: Option<(TxIn, TransactionU16LenLimited)>,
) -> Result<Option<InteractiveTxMessageSend>, APIError>
where ES::Target: EntropySource
{
let mut funding_inputs_with_extra = self.dual_funding_context_mut().our_funding_inputs.take().unwrap_or_else(|| vec![]);
let mut funding_inputs = self.dual_funding_context_mut().our_funding_inputs.take().unwrap_or_else(|| vec![]);

if let Some(extra_input) = extra_input {
funding_inputs_with_extra.push(extra_input);
if let Some(prev_funding_input) = prev_funding_input {
funding_inputs.push(prev_funding_input);
}

let mut funding_inputs_prev_outputs: Vec<TxOut> = Vec::with_capacity(funding_inputs_with_extra.len());
let mut funding_inputs_prev_outputs: Vec<TxOut> = Vec::with_capacity(funding_inputs.len());
// Check that vouts exist for each TxIn in provided transactions.
for (idx, input) in funding_inputs_with_extra.iter().enumerate() {
for (idx, input) in funding_inputs.iter().enumerate() {
if let Some(output) = input.1.as_transaction().output.get(input.0.previous_output.vout as usize) {
funding_inputs_prev_outputs.push(output.clone());
} else {
return Err(APIError::APIMisuseError {
err: format!("Transaction with txid {} does not have an output with vout of {} corresponding to TxIn at funding_inputs_with_extra[{}]",
err: format!("Transaction with txid {} does not have an output with vout of {} corresponding to TxIn at funding_inputs[{}]",
input.1.as_transaction().compute_txid(), input.0.previous_output.vout, idx) });
}
}

let total_input_satoshis: u64 = funding_inputs_with_extra.iter().map(
let total_input_satoshis: u64 = funding_inputs.iter().map(
|input| input.1.as_transaction().output.get(input.0.previous_output.vout as usize).map(|out| out.value.to_sat()).unwrap_or(0)
).sum();
if total_input_satoshis < self.dual_funding_context().our_funding_satoshis {
Expand Down Expand Up @@ -1769,7 +1769,7 @@ pub(super) trait InteractivelyFunded<SP: Deref> where SP::Target: SignerProvider
feerate_sat_per_kw: self.dual_funding_context_mut().funding_feerate_sat_per_1000_weight,
is_initiator: self.is_initiator(),
funding_tx_locktime: self.dual_funding_context_mut().funding_tx_locktime,
inputs_to_contribute: funding_inputs_with_extra,
inputs_to_contribute: funding_inputs,
outputs_to_contribute: funding_outputs,
expected_remote_shared_funding_output,
};
Expand Down

0 comments on commit b4f1fbf

Please sign in to comment.