Skip to content

Commit 1be45bc

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 0fe51c5 commit 1be45bc

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
@@ -2776,7 +2776,7 @@ where
27762776
debug_assert!(self.interactive_tx_constructor.is_none());
27772777

27782778
let mut funding_inputs = Vec::new();
2779-
mem::swap(&mut self.dual_funding_context.our_funding_inputs, &mut funding_inputs);
2779+
mem::swap(&mut self.funding_negotiation_context.our_funding_inputs, &mut funding_inputs);
27802780

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

@@ -2794,7 +2794,7 @@ where
27942794
if self.funding.is_outbound() {
27952795
funding_outputs.push(
27962796
OutputOwned::Shared(SharedOwnedOutput::new(
2797-
shared_funding_output, self.dual_funding_context.our_funding_satoshis,
2797+
shared_funding_output, self.funding_negotiation_context.our_funding_satoshis,
27982798
))
27992799
);
28002800
} else {
@@ -2810,9 +2810,9 @@ where
28102810
.map_err(|_err| AbortReason::InternalError("Error getting destination script"))?
28112811
};
28122812
let change_value_opt = calculate_change_output_value(
2813-
self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2813+
self.funding.is_outbound(), self.funding_negotiation_context.our_funding_satoshis,
28142814
&funding_inputs, &funding_outputs,
2815-
self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2815+
self.funding_negotiation_context.funding_feerate_sat_per_1000_weight,
28162816
change_script.minimal_non_dust().to_sat(),
28172817
)?;
28182818
if let Some(change_value) = change_value_opt {
@@ -2821,7 +2821,7 @@ where
28212821
script_pubkey: change_script,
28222822
};
28232823
let change_output_weight = get_output_weight(&change_output.script_pubkey).to_wu();
2824-
let change_output_fee = fee_for_weight(self.dual_funding_context.funding_feerate_sat_per_1000_weight, change_output_weight);
2824+
let change_output_fee = fee_for_weight(self.funding_negotiation_context.funding_feerate_sat_per_1000_weight, change_output_weight);
28252825
let change_value_decreased_with_fee = change_value.saturating_sub(change_output_fee);
28262826
// Check dust limit again
28272827
if change_value_decreased_with_fee > self.context.holder_dust_limit_satoshis {
@@ -2835,9 +2835,9 @@ where
28352835
holder_node_id,
28362836
counterparty_node_id: self.context.counterparty_node_id,
28372837
channel_id: self.context.channel_id(),
2838-
feerate_sat_per_kw: self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2838+
feerate_sat_per_kw: self.funding_negotiation_context.funding_feerate_sat_per_1000_weight,
28392839
is_initiator: self.funding.is_outbound(),
2840-
funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
2840+
funding_tx_locktime: self.funding_negotiation_context.funding_tx_locktime,
28412841
inputs_to_contribute: funding_inputs,
28422842
outputs_to_contribute: funding_outputs,
28432843
expected_remote_shared_funding_output,
@@ -2929,7 +2929,7 @@ where
29292929
where
29302930
L::Target: Logger
29312931
{
2932-
let our_funding_satoshis = self.dual_funding_context.our_funding_satoshis;
2932+
let our_funding_satoshis = self.funding_negotiation_context.our_funding_satoshis;
29332933
let transaction_number = self.unfunded_context.transaction_number();
29342934

29352935
let mut output_index = None;
@@ -5900,8 +5900,8 @@ fn check_v2_funding_inputs_sufficient(
59005900
}
59015901
}
59025902

5903-
/// Context for dual-funded channels.
5904-
pub(super) struct DualFundingChannelContext {
5903+
/// Context for negotiating channels (dual-funded V2 open, splicing)
5904+
pub(super) struct FundingNegotiationContext {
59055905
/// The amount in satoshis we will be contributing to the channel.
59065906
pub our_funding_satoshis: u64,
59075907
/// The amount in satoshis our counterparty will be contributing to the channel.
@@ -11812,7 +11812,7 @@ where
1181211812
pub funding: FundingScope,
1181311813
pub context: ChannelContext<SP>,
1181411814
pub unfunded_context: UnfundedChannelContext,
11815-
pub dual_funding_context: DualFundingChannelContext,
11815+
pub funding_negotiation_context: FundingNegotiationContext,
1181611816
/// The current interactive transaction construction session under negotiation.
1181711817
pub interactive_tx_constructor: Option<InteractiveTxConstructor>,
1181811818
/// The signing session created after `tx_complete` handling
@@ -11875,7 +11875,7 @@ where
1187511875
unfunded_channel_age_ticks: 0,
1187611876
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
1187711877
};
11878-
let dual_funding_context = DualFundingChannelContext {
11878+
let funding_negotiation_context = FundingNegotiationContext {
1187911879
our_funding_satoshis: funding_satoshis,
1188011880
// TODO(dual_funding) TODO(splicing) Include counterparty contribution, once that's enabled
1188111881
their_funding_satoshis: None,
@@ -11887,7 +11887,7 @@ where
1188711887
funding,
1188811888
context,
1188911889
unfunded_context,
11890-
dual_funding_context,
11890+
funding_negotiation_context,
1189111891
interactive_tx_constructor: None,
1189211892
interactive_tx_signing_session: None,
1189311893
};
@@ -11963,7 +11963,7 @@ where
1196311963
},
1196411964
funding_feerate_sat_per_1000_weight: self.context.feerate_per_kw,
1196511965
second_per_commitment_point,
11966-
locktime: self.dual_funding_context.funding_tx_locktime.to_consensus_u32(),
11966+
locktime: self.funding_negotiation_context.funding_tx_locktime.to_consensus_u32(),
1196711967
require_confirmed_inputs: None,
1196811968
}
1196911969
}
@@ -12035,7 +12035,7 @@ where
1203512035
&funding.get_counterparty_pubkeys().revocation_basepoint);
1203612036
context.channel_id = channel_id;
1203712037

12038-
let dual_funding_context = DualFundingChannelContext {
12038+
let funding_negotiation_context = FundingNegotiationContext {
1203912039
our_funding_satoshis: our_funding_satoshis,
1204012040
their_funding_satoshis: Some(msg.common_fields.funding_satoshis),
1204112041
funding_tx_locktime: LockTime::from_consensus(msg.locktime),
@@ -12049,8 +12049,8 @@ where
1204912049
holder_node_id,
1205012050
counterparty_node_id,
1205112051
channel_id: context.channel_id,
12052-
feerate_sat_per_kw: dual_funding_context.funding_feerate_sat_per_1000_weight,
12053-
funding_tx_locktime: dual_funding_context.funding_tx_locktime,
12052+
feerate_sat_per_kw: funding_negotiation_context.funding_feerate_sat_per_1000_weight,
12053+
funding_tx_locktime: funding_negotiation_context.funding_tx_locktime,
1205412054
is_initiator: false,
1205512055
inputs_to_contribute: our_funding_inputs,
1205612056
outputs_to_contribute: Vec::new(),
@@ -12068,7 +12068,7 @@ where
1206812068
Ok(Self {
1206912069
funding,
1207012070
context,
12071-
dual_funding_context,
12071+
funding_negotiation_context,
1207212072
interactive_tx_constructor,
1207312073
interactive_tx_signing_session: None,
1207412074
unfunded_context,
@@ -12134,7 +12134,7 @@ where
1213412134
}),
1213512135
channel_type: Some(self.funding.get_channel_type().clone()),
1213612136
},
12137-
funding_satoshis: self.dual_funding_context.our_funding_satoshis,
12137+
funding_satoshis: self.funding_negotiation_context.our_funding_satoshis,
1213812138
second_per_commitment_point,
1213912139
require_confirmed_inputs: None,
1214012140
}

lightning/src/ln/channelmanager.rs

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

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

0 commit comments

Comments
 (0)