Skip to content

Commit 445fb74

Browse files
optout21jkczyz
authored andcommitted
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 1d507f2 commit 445fb74

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

27792779
let mut funding_inputs = Vec::new();
2780-
mem::swap(&mut self.dual_funding_context.our_funding_inputs, &mut funding_inputs);
2780+
mem::swap(&mut self.funding_negotiation_context.our_funding_inputs, &mut funding_inputs);
27812781

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

@@ -2799,10 +2799,10 @@ where
27992799
.map_err(|_err| AbortReason::InternalError("Error getting destination script"))?
28002800
};
28012801
let change_value_opt = calculate_change_output_value(
2802-
self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2802+
self.funding.is_outbound(), self.funding_negotiation_context.our_funding_satoshis,
28032803
&funding_inputs, None,
28042804
&shared_funding_output.script_pubkey, &funding_outputs,
2805-
self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2805+
self.funding_negotiation_context.funding_feerate_sat_per_1000_weight,
28062806
change_script.minimal_non_dust().to_sat(),
28072807
)?;
28082808
if let Some(change_value) = change_value_opt {
@@ -2811,7 +2811,7 @@ where
28112811
script_pubkey: change_script,
28122812
};
28132813
let change_output_weight = get_output_weight(&change_output.script_pubkey).to_wu();
2814-
let change_output_fee = fee_for_weight(self.dual_funding_context.funding_feerate_sat_per_1000_weight, change_output_weight);
2814+
let change_output_fee = fee_for_weight(self.funding_negotiation_context.funding_feerate_sat_per_1000_weight, change_output_weight);
28152815
let change_value_decreased_with_fee = change_value.saturating_sub(change_output_fee);
28162816
// Check dust limit again
28172817
if change_value_decreased_with_fee > self.context.holder_dust_limit_satoshis {
@@ -2825,12 +2825,12 @@ where
28252825
holder_node_id,
28262826
counterparty_node_id: self.context.counterparty_node_id,
28272827
channel_id: self.context.channel_id(),
2828-
feerate_sat_per_kw: self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2828+
feerate_sat_per_kw: self.funding_negotiation_context.funding_feerate_sat_per_1000_weight,
28292829
is_initiator: self.funding.is_outbound(),
2830-
funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
2830+
funding_tx_locktime: self.funding_negotiation_context.funding_tx_locktime,
28312831
inputs_to_contribute: funding_inputs,
28322832
shared_funding_input: None,
2833-
shared_funding_output: SharedOwnedOutput::new(shared_funding_output, self.dual_funding_context.our_funding_satoshis),
2833+
shared_funding_output: SharedOwnedOutput::new(shared_funding_output, self.funding_negotiation_context.our_funding_satoshis),
28342834
outputs_to_contribute: funding_outputs,
28352835
};
28362836
let mut tx_constructor = InteractiveTxConstructor::new(constructor_args)?;
@@ -2920,7 +2920,7 @@ where
29202920
where
29212921
L::Target: Logger
29222922
{
2923-
let our_funding_satoshis = self.dual_funding_context.our_funding_satoshis;
2923+
let our_funding_satoshis = self.funding_negotiation_context.our_funding_satoshis;
29242924
let transaction_number = self.unfunded_context.transaction_number();
29252925

29262926
let mut output_index = None;
@@ -5841,8 +5841,8 @@ fn check_v2_funding_inputs_sufficient(
58415841
}
58425842
}
58435843

5844-
/// Context for dual-funded channels.
5845-
pub(super) struct DualFundingChannelContext {
5844+
/// Context for negotiating channels (dual-funded V2 open, splicing)
5845+
pub(super) struct FundingNegotiationContext {
58465846
/// The amount in satoshis we will be contributing to the channel.
58475847
pub our_funding_satoshis: u64,
58485848
/// The amount in satoshis our counterparty will be contributing to the channel.
@@ -11796,7 +11796,7 @@ where
1179611796
pub funding: FundingScope,
1179711797
pub context: ChannelContext<SP>,
1179811798
pub unfunded_context: UnfundedChannelContext,
11799-
pub dual_funding_context: DualFundingChannelContext,
11799+
pub funding_negotiation_context: FundingNegotiationContext,
1180011800
/// The current interactive transaction construction session under negotiation.
1180111801
pub interactive_tx_constructor: Option<InteractiveTxConstructor>,
1180211802
/// The signing session created after `tx_complete` handling
@@ -11859,7 +11859,7 @@ where
1185911859
unfunded_channel_age_ticks: 0,
1186011860
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
1186111861
};
11862-
let dual_funding_context = DualFundingChannelContext {
11862+
let funding_negotiation_context = FundingNegotiationContext {
1186311863
our_funding_satoshis: funding_satoshis,
1186411864
// TODO(dual_funding) TODO(splicing) Include counterparty contribution, once that's enabled
1186511865
their_funding_satoshis: None,
@@ -11871,7 +11871,7 @@ where
1187111871
funding,
1187211872
context,
1187311873
unfunded_context,
11874-
dual_funding_context,
11874+
funding_negotiation_context,
1187511875
interactive_tx_constructor: None,
1187611876
interactive_tx_signing_session: None,
1187711877
};
@@ -11947,7 +11947,7 @@ where
1194711947
},
1194811948
funding_feerate_sat_per_1000_weight: self.context.feerate_per_kw,
1194911949
second_per_commitment_point,
11950-
locktime: self.dual_funding_context.funding_tx_locktime.to_consensus_u32(),
11950+
locktime: self.funding_negotiation_context.funding_tx_locktime.to_consensus_u32(),
1195111951
require_confirmed_inputs: None,
1195211952
}
1195311953
}
@@ -12019,7 +12019,7 @@ where
1201912019
&funding.get_counterparty_pubkeys().revocation_basepoint);
1202012020
context.channel_id = channel_id;
1202112021

12022-
let dual_funding_context = DualFundingChannelContext {
12022+
let funding_negotiation_context = FundingNegotiationContext {
1202312023
our_funding_satoshis: our_funding_satoshis,
1202412024
their_funding_satoshis: Some(msg.common_fields.funding_satoshis),
1202512025
funding_tx_locktime: LockTime::from_consensus(msg.locktime),
@@ -12037,8 +12037,8 @@ where
1203712037
holder_node_id,
1203812038
counterparty_node_id,
1203912039
channel_id: context.channel_id,
12040-
feerate_sat_per_kw: dual_funding_context.funding_feerate_sat_per_1000_weight,
12041-
funding_tx_locktime: dual_funding_context.funding_tx_locktime,
12040+
feerate_sat_per_kw: funding_negotiation_context.funding_feerate_sat_per_1000_weight,
12041+
funding_tx_locktime: funding_negotiation_context.funding_tx_locktime,
1204212042
is_initiator: false,
1204312043
inputs_to_contribute: our_funding_inputs,
1204412044
shared_funding_input: None,
@@ -12057,7 +12057,7 @@ where
1205712057
Ok(Self {
1205812058
funding,
1205912059
context,
12060-
dual_funding_context,
12060+
funding_negotiation_context,
1206112061
interactive_tx_constructor,
1206212062
interactive_tx_signing_session: None,
1206312063
unfunded_context,
@@ -12123,7 +12123,7 @@ where
1212312123
}),
1212412124
channel_type: Some(self.funding.get_channel_type().clone()),
1212512125
},
12126-
funding_satoshis: self.dual_funding_context.our_funding_satoshis,
12126+
funding_satoshis: self.funding_negotiation_context.our_funding_satoshis,
1212712127
second_per_commitment_point,
1212812128
require_confirmed_inputs: None,
1212912129
}

lightning/src/ln/channelmanager.rs

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

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

0 commit comments

Comments
 (0)