Skip to content

Commit 823e251

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 7ec13dc commit 823e251

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
@@ -2772,7 +2772,7 @@ where
27722772
debug_assert!(self.interactive_tx_constructor.is_none());
27732773

27742774
let mut funding_inputs = Vec::new();
2775-
mem::swap(&mut self.dual_funding_context.our_funding_inputs, &mut funding_inputs);
2775+
mem::swap(&mut self.funding_negotiation_context.our_funding_inputs, &mut funding_inputs);
27762776

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

@@ -2794,10 +2794,10 @@ where
27942794
.map_err(|_err| AbortReason::InternalError("Error getting destination script"))?
27952795
};
27962796
let change_value_opt = calculate_change_output_value(
2797-
self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2797+
self.funding.is_outbound(), self.funding_negotiation_context.our_funding_satoshis,
27982798
&funding_inputs, None,
27992799
&shared_funding_output.script_pubkey, &funding_outputs,
2800-
self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2800+
self.funding_negotiation_context.funding_feerate_sat_per_1000_weight,
28012801
change_script.minimal_non_dust().to_sat(),
28022802
)?;
28032803
if let Some(change_value) = change_value_opt {
@@ -2806,7 +2806,7 @@ where
28062806
script_pubkey: change_script,
28072807
};
28082808
let change_output_weight = get_output_weight(&change_output.script_pubkey).to_wu();
2809-
let change_output_fee = fee_for_weight(self.dual_funding_context.funding_feerate_sat_per_1000_weight, change_output_weight);
2809+
let change_output_fee = fee_for_weight(self.funding_negotiation_context.funding_feerate_sat_per_1000_weight, change_output_weight);
28102810
let change_value_decreased_with_fee = change_value.saturating_sub(change_output_fee);
28112811
// Check dust limit again
28122812
if change_value_decreased_with_fee > self.context.holder_dust_limit_satoshis {
@@ -2820,12 +2820,12 @@ where
28202820
holder_node_id,
28212821
counterparty_node_id: self.context.counterparty_node_id,
28222822
channel_id: self.context.channel_id(),
2823-
feerate_sat_per_kw: self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2823+
feerate_sat_per_kw: self.funding_negotiation_context.funding_feerate_sat_per_1000_weight,
28242824
is_initiator: self.funding.is_outbound(),
2825-
funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
2825+
funding_tx_locktime: self.funding_negotiation_context.funding_tx_locktime,
28262826
inputs_to_contribute: funding_inputs,
28272827
shared_funding_input: None,
2828-
shared_funding_output: SharedOwnedOutput::new(shared_funding_output, self.dual_funding_context.our_funding_satoshis),
2828+
shared_funding_output: SharedOwnedOutput::new(shared_funding_output, self.funding_negotiation_context.our_funding_satoshis),
28292829
outputs_to_contribute: funding_outputs,
28302830
};
28312831
let mut tx_constructor = InteractiveTxConstructor::new(constructor_args)?;
@@ -2915,7 +2915,7 @@ where
29152915
where
29162916
L::Target: Logger
29172917
{
2918-
let our_funding_satoshis = self.dual_funding_context.our_funding_satoshis;
2918+
let our_funding_satoshis = self.funding_negotiation_context.our_funding_satoshis;
29192919
let transaction_number = self.unfunded_context.transaction_number();
29202920

29212921
let mut output_index = None;
@@ -5853,8 +5853,8 @@ fn check_v2_funding_inputs_sufficient(
58535853
}
58545854
}
58555855

5856-
/// Context for dual-funded channels.
5857-
pub(super) struct DualFundingChannelContext {
5856+
/// Context for negotiating channels (dual-funded V2 open, splicing)
5857+
pub(super) struct FundingNegotiationContext {
58585858
/// The amount in satoshis we will be contributing to the channel.
58595859
pub our_funding_satoshis: u64,
58605860
/// The amount in satoshis our counterparty will be contributing to the channel.
@@ -12021,7 +12021,7 @@ where
1202112021
pub funding: FundingScope,
1202212022
pub context: ChannelContext<SP>,
1202312023
pub unfunded_context: UnfundedChannelContext,
12024-
pub dual_funding_context: DualFundingChannelContext,
12024+
pub funding_negotiation_context: FundingNegotiationContext,
1202512025
/// The current interactive transaction construction session under negotiation.
1202612026
pub interactive_tx_constructor: Option<InteractiveTxConstructor>,
1202712027
/// The signing session created after `tx_complete` handling
@@ -12084,7 +12084,7 @@ where
1208412084
unfunded_channel_age_ticks: 0,
1208512085
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
1208612086
};
12087-
let dual_funding_context = DualFundingChannelContext {
12087+
let funding_negotiation_context = FundingNegotiationContext {
1208812088
our_funding_satoshis: funding_satoshis,
1208912089
// TODO(dual_funding) TODO(splicing) Include counterparty contribution, once that's enabled
1209012090
their_funding_satoshis: None,
@@ -12096,7 +12096,7 @@ where
1209612096
funding,
1209712097
context,
1209812098
unfunded_context,
12099-
dual_funding_context,
12099+
funding_negotiation_context,
1210012100
interactive_tx_constructor: None,
1210112101
interactive_tx_signing_session: None,
1210212102
};
@@ -12172,7 +12172,7 @@ where
1217212172
},
1217312173
funding_feerate_sat_per_1000_weight: self.context.feerate_per_kw,
1217412174
second_per_commitment_point,
12175-
locktime: self.dual_funding_context.funding_tx_locktime.to_consensus_u32(),
12175+
locktime: self.funding_negotiation_context.funding_tx_locktime.to_consensus_u32(),
1217612176
require_confirmed_inputs: None,
1217712177
}
1217812178
}
@@ -12238,7 +12238,7 @@ where
1223812238
&funding.get_counterparty_pubkeys().revocation_basepoint);
1223912239
context.channel_id = channel_id;
1224012240

12241-
let dual_funding_context = DualFundingChannelContext {
12241+
let funding_negotiation_context = FundingNegotiationContext {
1224212242
our_funding_satoshis: our_funding_satoshis,
1224312243
their_funding_satoshis: Some(msg.common_fields.funding_satoshis),
1224412244
funding_tx_locktime: LockTime::from_consensus(msg.locktime),
@@ -12256,8 +12256,8 @@ where
1225612256
holder_node_id,
1225712257
counterparty_node_id,
1225812258
channel_id: context.channel_id,
12259-
feerate_sat_per_kw: dual_funding_context.funding_feerate_sat_per_1000_weight,
12260-
funding_tx_locktime: dual_funding_context.funding_tx_locktime,
12259+
feerate_sat_per_kw: funding_negotiation_context.funding_feerate_sat_per_1000_weight,
12260+
funding_tx_locktime: funding_negotiation_context.funding_tx_locktime,
1226112261
is_initiator: false,
1226212262
inputs_to_contribute: our_funding_inputs,
1226312263
shared_funding_input: None,
@@ -12276,7 +12276,7 @@ where
1227612276
Ok(Self {
1227712277
funding,
1227812278
context,
12279-
dual_funding_context,
12279+
funding_negotiation_context,
1228012280
interactive_tx_constructor,
1228112281
interactive_tx_signing_session: None,
1228212282
unfunded_context,
@@ -12342,7 +12342,7 @@ where
1234212342
}),
1234312343
channel_type: Some(self.funding.get_channel_type().clone()),
1234412344
},
12345-
funding_satoshis: self.dual_funding_context.our_funding_satoshis,
12345+
funding_satoshis: self.funding_negotiation_context.our_funding_satoshis,
1234612346
second_per_commitment_point,
1234712347
require_confirmed_inputs: None,
1234812348
}

lightning/src/ln/channelmanager.rs

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

91919191
// Inbound V2 channels with contributed inputs are not considered unfunded.
91929192
if let Some(unfunded_chan) = chan.as_unfunded_v2() {
9193-
if unfunded_chan.dual_funding_context.our_funding_satoshis != 0 {
9193+
if unfunded_chan.funding_negotiation_context.our_funding_satoshis != 0 {
91949194
continue;
91959195
}
91969196
}

0 commit comments

Comments
 (0)