Skip to content

Commit 0b89a36

Browse files
committed
Rename DualFundingContext
This is a simple rename, DualFundingContext to FundingNegotiationContext, to suggest that this is use not only in dual-funded channel open. Also rename the field dual_funding_context to funding_negotiation_context.
1 parent b5bfa85 commit 0b89a36

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

lightning/src/ln/channel.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2714,7 +2714,7 @@ where
27142714
debug_assert!(self.interactive_tx_constructor.is_none());
27152715

27162716
let mut funding_inputs = Vec::new();
2717-
mem::swap(&mut self.dual_funding_context.our_funding_inputs, &mut funding_inputs);
2717+
mem::swap(&mut self.funding_negotiation_context.our_funding_inputs, &mut funding_inputs);
27182718

27192719
// TODO(splicing): Add prev funding tx as input, must be provided as a parameter
27202720

@@ -2732,7 +2732,7 @@ where
27322732
if self.funding.is_outbound() {
27332733
funding_outputs.push(
27342734
OutputOwned::Shared(SharedOwnedOutput::new(
2735-
shared_funding_output, self.dual_funding_context.our_funding_satoshis,
2735+
shared_funding_output, self.funding_negotiation_context.our_funding_satoshis,
27362736
))
27372737
);
27382738
} else {
@@ -2748,9 +2748,9 @@ where
27482748
.map_err(|_err| AbortReason::InternalError("Error getting destination script"))?
27492749
};
27502750
let change_value_opt = calculate_change_output_value(
2751-
self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2751+
self.funding.is_outbound(), self.funding_negotiation_context.our_funding_satoshis,
27522752
&funding_inputs, &funding_outputs,
2753-
self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2753+
self.funding_negotiation_context.funding_feerate_sat_per_1000_weight,
27542754
change_script.minimal_non_dust().to_sat(),
27552755
)?;
27562756
if let Some(change_value) = change_value_opt {
@@ -2759,7 +2759,7 @@ where
27592759
script_pubkey: change_script,
27602760
};
27612761
let change_output_weight = get_output_weight(&change_output.script_pubkey).to_wu();
2762-
let change_output_fee = fee_for_weight(self.dual_funding_context.funding_feerate_sat_per_1000_weight, change_output_weight);
2762+
let change_output_fee = fee_for_weight(self.funding_negotiation_context.funding_feerate_sat_per_1000_weight, change_output_weight);
27632763
let change_value_decreased_with_fee = change_value.saturating_sub(change_output_fee);
27642764
// Check dust limit again
27652765
if change_value_decreased_with_fee > self.context.holder_dust_limit_satoshis {
@@ -2773,9 +2773,9 @@ where
27732773
holder_node_id,
27742774
counterparty_node_id: self.context.counterparty_node_id,
27752775
channel_id: self.context.channel_id(),
2776-
feerate_sat_per_kw: self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2776+
feerate_sat_per_kw: self.funding_negotiation_context.funding_feerate_sat_per_1000_weight,
27772777
is_initiator: self.funding.is_outbound(),
2778-
funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
2778+
funding_tx_locktime: self.funding_negotiation_context.funding_tx_locktime,
27792779
inputs_to_contribute: funding_inputs,
27802780
outputs_to_contribute: funding_outputs,
27812781
expected_remote_shared_funding_output,
@@ -2867,7 +2867,7 @@ where
28672867
where
28682868
L::Target: Logger
28692869
{
2870-
let our_funding_satoshis = self.dual_funding_context.our_funding_satoshis;
2870+
let our_funding_satoshis = self.funding_negotiation_context.our_funding_satoshis;
28712871
let transaction_number = self.unfunded_context.transaction_number();
28722872

28732873
let mut output_index = None;
@@ -5782,8 +5782,8 @@ fn check_v2_funding_inputs_sufficient(
57825782
}
57835783
}
57845784

5785-
/// Context for dual-funded channels.
5786-
pub(super) struct DualFundingChannelContext {
5785+
/// Context for negotiating channels (dual-funded V2 open, splicing)
5786+
pub(super) struct FundingNegotiationContext {
57875787
/// The amount in satoshis we will be contributing to the channel.
57885788
pub our_funding_satoshis: u64,
57895789
/// The amount in satoshis our counterparty will be contributing to the channel.
@@ -11364,7 +11364,7 @@ where
1136411364
pub funding: FundingScope,
1136511365
pub context: ChannelContext<SP>,
1136611366
pub unfunded_context: UnfundedChannelContext,
11367-
pub dual_funding_context: DualFundingChannelContext,
11367+
pub funding_negotiation_context: FundingNegotiationContext,
1136811368
/// The current interactive transaction construction session under negotiation.
1136911369
pub interactive_tx_constructor: Option<InteractiveTxConstructor>,
1137011370
/// The signing session created after `tx_complete` handling
@@ -11427,7 +11427,7 @@ where
1142711427
unfunded_channel_age_ticks: 0,
1142811428
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
1142911429
};
11430-
let dual_funding_context = DualFundingChannelContext {
11430+
let funding_negotiation_context = FundingNegotiationContext {
1143111431
our_funding_satoshis: funding_satoshis,
1143211432
// TODO(dual_funding) TODO(splicing) Include counterparty contribution, once that's enabled
1143311433
their_funding_satoshis: None,
@@ -11439,7 +11439,7 @@ where
1143911439
funding,
1144011440
context,
1144111441
unfunded_context,
11442-
dual_funding_context,
11442+
funding_negotiation_context,
1144311443
interactive_tx_constructor: None,
1144411444
interactive_tx_signing_session: None,
1144511445
};
@@ -11515,7 +11515,7 @@ where
1151511515
},
1151611516
funding_feerate_sat_per_1000_weight: self.context.feerate_per_kw,
1151711517
second_per_commitment_point,
11518-
locktime: self.dual_funding_context.funding_tx_locktime.to_consensus_u32(),
11518+
locktime: self.funding_negotiation_context.funding_tx_locktime.to_consensus_u32(),
1151911519
require_confirmed_inputs: None,
1152011520
}
1152111521
}
@@ -11587,7 +11587,7 @@ where
1158711587
&funding.get_counterparty_pubkeys().revocation_basepoint);
1158811588
context.channel_id = channel_id;
1158911589

11590-
let dual_funding_context = DualFundingChannelContext {
11590+
let funding_negotiation_context = FundingNegotiationContext {
1159111591
our_funding_satoshis: our_funding_satoshis,
1159211592
their_funding_satoshis: Some(msg.common_fields.funding_satoshis),
1159311593
funding_tx_locktime: LockTime::from_consensus(msg.locktime),
@@ -11601,8 +11601,8 @@ where
1160111601
holder_node_id,
1160211602
counterparty_node_id,
1160311603
channel_id: context.channel_id,
11604-
feerate_sat_per_kw: dual_funding_context.funding_feerate_sat_per_1000_weight,
11605-
funding_tx_locktime: dual_funding_context.funding_tx_locktime,
11604+
feerate_sat_per_kw: funding_negotiation_context.funding_feerate_sat_per_1000_weight,
11605+
funding_tx_locktime: funding_negotiation_context.funding_tx_locktime,
1160611606
is_initiator: false,
1160711607
inputs_to_contribute: our_funding_inputs,
1160811608
outputs_to_contribute: Vec::new(),
@@ -11620,7 +11620,7 @@ where
1162011620
Ok(Self {
1162111621
funding,
1162211622
context,
11623-
dual_funding_context,
11623+
funding_negotiation_context,
1162411624
interactive_tx_constructor,
1162511625
interactive_tx_signing_session: None,
1162611626
unfunded_context,
@@ -11686,7 +11686,7 @@ where
1168611686
}),
1168711687
channel_type: Some(self.funding.get_channel_type().clone()),
1168811688
},
11689-
funding_satoshis: self.dual_funding_context.our_funding_satoshis,
11689+
funding_satoshis: self.funding_negotiation_context.our_funding_satoshis,
1169011690
second_per_commitment_point,
1169111691
require_confirmed_inputs: None,
1169211692
}

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8482,7 +8482,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
84828482

84838483
// Inbound V2 channels with contributed inputs are not considered unfunded.
84848484
if let Some(unfunded_chan) = chan.as_unfunded_v2() {
8485-
if unfunded_chan.dual_funding_context.our_funding_satoshis != 0 {
8485+
if unfunded_chan.funding_negotiation_context.our_funding_satoshis != 0 {
84868486
continue;
84878487
}
84888488
}

0 commit comments

Comments
 (0)