Skip to content

Commit 6e8aa63

Browse files
committed
fix Rename DualFundingContext
1 parent d2554a8 commit 6e8aa63

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

lightning/src/ln/channel.rs

+37-37
Original file line numberDiff line numberDiff line change
@@ -2472,13 +2472,13 @@ impl<'a, SP: Deref> FundingTxConstructorV2<SP> for FundedChannelRefundingWrapper
24722472
}
24732473

24742474
#[inline]
2475-
fn dual_funding_context(&self) -> &DualFundingChannelContext {
2476-
&self.refunding_scope.pending_dual_funding_context
2475+
fn funding_negotiation_context(&self) -> &FundingNegotiationContext {
2476+
&self.refunding_scope.pending_funding_negotiation_context
24772477
}
24782478

24792479
#[inline]
2480-
fn dual_funding_context_mut(&mut self) -> &mut DualFundingChannelContext {
2481-
&mut self.refunding_scope.pending_dual_funding_context
2480+
fn funding_negotiation_context_mut(&mut self) -> &mut FundingNegotiationContext {
2481+
&mut self.refunding_scope.pending_funding_negotiation_context
24822482
}
24832483

24842484
fn transaction_number(&self) -> u64 {
@@ -2507,8 +2507,8 @@ pub(super) trait FundingTxConstructorV2<SP: Deref>: ChannelContextProvider<SP> w
25072507
fn pending_funding(&self) -> &FundingScope;
25082508
fn pending_funding_mut(&mut self) -> &mut FundingScope;
25092509
fn pending_funding_and_context_mut(&mut self) -> (&FundingScope, &mut ChannelContext<SP>);
2510-
fn dual_funding_context(&self) -> &DualFundingChannelContext;
2511-
fn dual_funding_context_mut(&mut self) -> &mut DualFundingChannelContext;
2510+
fn funding_negotiation_context(&self) -> &FundingNegotiationContext;
2511+
fn funding_negotiation_context_mut(&mut self) -> &mut FundingNegotiationContext;
25122512
fn transaction_number(&self) -> u64;
25132513
fn interactive_tx_constructor(&self) -> Option<&InteractiveTxConstructor>;
25142514
fn interactive_tx_constructor_mut(&mut self) -> &mut Option<InteractiveTxConstructor>;
@@ -2535,8 +2535,8 @@ pub(super) trait FundingTxConstructorV2<SP: Deref>: ChannelContextProvider<SP> w
25352535
debug_assert!(self.interactive_tx_constructor().is_none());
25362536

25372537
let mut funding_inputs = Vec::new();
2538-
let dual_funding_context_mut = self.dual_funding_context_mut();
2539-
mem::swap(&mut dual_funding_context_mut.our_funding_inputs, &mut funding_inputs);
2538+
let funding_negotiation_context_mut = self.funding_negotiation_context_mut();
2539+
mem::swap(&mut funding_negotiation_context_mut.our_funding_inputs, &mut funding_inputs);
25402540

25412541
if let Some(prev_funding_input) = prev_funding_input {
25422542
funding_inputs.push(prev_funding_input);
@@ -2555,11 +2555,11 @@ pub(super) trait FundingTxConstructorV2<SP: Deref>: ChannelContextProvider<SP> w
25552555
script_pubkey: pending_funding.get_funding_redeemscript().to_p2wsh(),
25562556
};
25572557

2558-
let dual_funding_context = &self.dual_funding_context();
2558+
let funding_negotiation_context = &self.funding_negotiation_context();
25592559
if pending_funding.is_outbound() {
25602560
funding_outputs.push(
25612561
OutputOwned::Shared(SharedOwnedOutput::new(
2562-
shared_funding_output, dual_funding_context.our_funding_satoshis,
2562+
shared_funding_output, funding_negotiation_context.our_funding_satoshis,
25632563
))
25642564
);
25652565
} else {
@@ -2575,9 +2575,9 @@ pub(super) trait FundingTxConstructorV2<SP: Deref>: ChannelContextProvider<SP> w
25752575
.map_err(|_err| AbortReason::InternalError("Error getting destination script"))?
25762576
};
25772577
let change_value_opt = calculate_change_output_value(
2578-
pending_funding.is_outbound(), dual_funding_context.our_funding_satoshis,
2578+
pending_funding.is_outbound(), funding_negotiation_context.our_funding_satoshis,
25792579
&funding_inputs, &funding_outputs,
2580-
dual_funding_context.funding_feerate_sat_per_1000_weight,
2580+
funding_negotiation_context.funding_feerate_sat_per_1000_weight,
25812581
change_script.minimal_non_dust().to_sat(),
25822582
)?;
25832583
if let Some(change_value) = change_value_opt {
@@ -2586,7 +2586,7 @@ pub(super) trait FundingTxConstructorV2<SP: Deref>: ChannelContextProvider<SP> w
25862586
script_pubkey: change_script,
25872587
};
25882588
let change_output_weight = get_output_weight(&change_output.script_pubkey).to_wu();
2589-
let change_output_fee = fee_for_weight(dual_funding_context.funding_feerate_sat_per_1000_weight, change_output_weight);
2589+
let change_output_fee = fee_for_weight(funding_negotiation_context.funding_feerate_sat_per_1000_weight, change_output_weight);
25902590
let change_value_decreased_with_fee = change_value.saturating_sub(change_output_fee);
25912591
// Check dust limit again
25922592
if change_value_decreased_with_fee > self.context().holder_dust_limit_satoshis {
@@ -2600,9 +2600,9 @@ pub(super) trait FundingTxConstructorV2<SP: Deref>: ChannelContextProvider<SP> w
26002600
holder_node_id,
26012601
counterparty_node_id: self.context().counterparty_node_id,
26022602
channel_id: self.context().channel_id(),
2603-
feerate_sat_per_kw: dual_funding_context.funding_feerate_sat_per_1000_weight,
2603+
feerate_sat_per_kw: funding_negotiation_context.funding_feerate_sat_per_1000_weight,
26042604
is_initiator: pending_funding.is_outbound(),
2605-
funding_tx_locktime: dual_funding_context.funding_tx_locktime,
2605+
funding_tx_locktime: funding_negotiation_context.funding_tx_locktime,
26062606
inputs_to_contribute: funding_inputs,
26072607
outputs_to_contribute: funding_outputs,
26082608
expected_remote_shared_funding_output,
@@ -2692,7 +2692,7 @@ pub(super) trait FundingTxConstructorV2<SP: Deref>: ChannelContextProvider<SP> w
26922692
where
26932693
L::Target: Logger
26942694
{
2695-
let our_funding_satoshis = self.dual_funding_context()
2695+
let our_funding_satoshis = self.funding_negotiation_context()
26962696
.our_funding_satoshis;
26972697
let transaction_number = self.transaction_number();
26982698
let pending_funding = self.pending_funding();
@@ -2816,13 +2816,13 @@ impl<SP: Deref> FundingTxConstructorV2<SP> for PendingV2Channel<SP> where SP::Ta
28162816
}
28172817

28182818
#[inline]
2819-
fn dual_funding_context(&self) -> &DualFundingChannelContext {
2820-
&self.dual_funding_context
2819+
fn funding_negotiation_context(&self) -> &FundingNegotiationContext {
2820+
&self.funding_negotiation_context
28212821
}
28222822

28232823
#[inline]
2824-
fn dual_funding_context_mut(&mut self) -> &mut DualFundingChannelContext {
2825-
&mut self.dual_funding_context
2824+
fn funding_negotiation_context_mut(&mut self) -> &mut FundingNegotiationContext {
2825+
&mut self.funding_negotiation_context
28262826
}
28272827

28282828
fn transaction_number(&self) -> u64 {
@@ -2851,7 +2851,7 @@ impl<SP: Deref> FundingTxConstructorV2<SP> for PendingV2Channel<SP> where SP::Ta
28512851
struct RefundingScope {
28522852
// Fields belonging for [`PendingV2Channel`], except the context
28532853
pending_funding: FundingScope,
2854-
pending_dual_funding_context: DualFundingChannelContext,
2854+
pending_funding_negotiation_context: FundingNegotiationContext,
28552855
/// The current interactive transaction construction session under negotiation.
28562856
pending_interactive_tx_constructor: Option<InteractiveTxConstructor>,
28572857
pending_interactive_tx_signing_session: Option<InteractiveTxSigningSession>,
@@ -5293,7 +5293,7 @@ fn check_v2_funding_inputs_sufficient(
52935293
}
52945294

52955295
/// Context for dual-funded channels.
5296-
pub(super) struct DualFundingChannelContext {
5296+
pub(super) struct FundingNegotiationContext {
52975297
/// The amount in satoshis we will be contributing to the channel.
52985298
pub our_funding_satoshis: u64,
52995299
/// The amount in satoshis our counterparty will be contributing to the channel.
@@ -9124,7 +9124,7 @@ impl<SP: Deref> FundedChannel<SP> where
91249124
next_remote_commitment_tx_fee_info_cached: Mutex::new(None),
91259125
};
91269126

9127-
let pending_dual_funding_context = DualFundingChannelContext {
9127+
let pending_funding_negotiation_context = FundingNegotiationContext {
91289128
our_funding_satoshis,
91299129
their_funding_satoshis: Some(their_funding_satoshis),
91309130
funding_tx_locktime: LockTime::from_consensus(msg.locktime),
@@ -9134,15 +9134,15 @@ impl<SP: Deref> FundedChannel<SP> where
91349134

91359135
let refunding_scope = Some(RefundingScope {
91369136
pending_funding,
9137-
pending_dual_funding_context,
9137+
pending_funding_negotiation_context,
91389138
pending_interactive_tx_constructor: None,
91399139
pending_interactive_tx_signing_session: None,
91409140
});
91419141
self.pending_splice = Some(PendingSplice {
91429142
our_funding_contribution,
91439143
funding_feerate_per_kw: msg.funding_feerate_per_kw,
91449144
locktime: msg.locktime,
9145-
our_funding_inputs: Vec::new(), // inputs go directly to [`DualFundingChannelContext`] above
9145+
our_funding_inputs: Vec::new(), // inputs go directly to [`FundingNegotiationContext`] above
91469146
awaiting_splice_ack: false, // we don't need any additional message for the handshake
91479147
refunding_scope,
91489148
});
@@ -9244,20 +9244,20 @@ impl<SP: Deref> FundedChannel<SP> where
92449244
next_remote_commitment_tx_fee_info_cached: Mutex::new(None),
92459245
};
92469246

9247-
let mut pending_dual_funding_context = DualFundingChannelContext {
9247+
let mut pending_funding_negotiation_context = FundingNegotiationContext {
92489248
our_funding_satoshis,
92499249
their_funding_satoshis: Some(their_funding_satoshis),
92509250
funding_tx_locktime: LockTime::from_consensus(pending_splice.locktime),
92519251
funding_feerate_sat_per_1000_weight: pending_splice.funding_feerate_per_kw,
92529252
our_funding_inputs: Vec::new(), // set below
92539253
};
92549254
if let Some(ref mut pending_splice_mut) = &mut self.pending_splice {
9255-
pending_dual_funding_context.our_funding_inputs = std::mem::take(&mut pending_splice_mut.our_funding_inputs);
9255+
pending_funding_negotiation_context.our_funding_inputs = std::mem::take(&mut pending_splice_mut.our_funding_inputs);
92569256
};
92579257

92589258
let refunding_scope = RefundingScope {
92599259
pending_funding,
9260-
pending_dual_funding_context,
9260+
pending_funding_negotiation_context,
92619261
pending_interactive_tx_constructor: None,
92629262
pending_interactive_tx_signing_session: None,
92639263
};
@@ -10659,7 +10659,7 @@ pub(super) struct PendingV2Channel<SP: Deref> where SP::Target: SignerProvider {
1065910659
pub funding: FundingScope,
1066010660
pub context: ChannelContext<SP>,
1066110661
pub unfunded_context: UnfundedChannelContext,
10662-
pub dual_funding_context: DualFundingChannelContext,
10662+
pub funding_negotiation_context: FundingNegotiationContext,
1066310663
/// The current interactive transaction construction session under negotiation.
1066410664
pub interactive_tx_constructor: Option<InteractiveTxConstructor>,
1066510665
/// The signing session created after `tx_complete` handling
@@ -10718,7 +10718,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1071810718
unfunded_channel_age_ticks: 0,
1071910719
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
1072010720
};
10721-
let dual_funding_context = DualFundingChannelContext {
10721+
let funding_negotiation_context = FundingNegotiationContext {
1072210722
our_funding_satoshis: funding_satoshis,
1072310723
// TODO(dual_funding) TODO(splicing) Include counterparty contribution, once that's enabled
1072410724
their_funding_satoshis: None,
@@ -10730,7 +10730,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1073010730
funding,
1073110731
context,
1073210732
unfunded_context,
10733-
dual_funding_context,
10733+
funding_negotiation_context,
1073410734
interactive_tx_constructor: None,
1073510735
interactive_tx_signing_session: None,
1073610736
};
@@ -10799,7 +10799,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1079910799
},
1080010800
funding_feerate_sat_per_1000_weight: self.context.feerate_per_kw,
1080110801
second_per_commitment_point,
10802-
locktime: self.dual_funding_context.funding_tx_locktime.to_consensus_u32(),
10802+
locktime: self.funding_negotiation_context.funding_tx_locktime.to_consensus_u32(),
1080310803
require_confirmed_inputs: None,
1080410804
}
1080510805
}
@@ -10870,7 +10870,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1087010870
&funding.get_counterparty_pubkeys().revocation_basepoint);
1087110871
context.channel_id = channel_id;
1087210872

10873-
let dual_funding_context = DualFundingChannelContext {
10873+
let funding_negotiation_context = FundingNegotiationContext {
1087410874
our_funding_satoshis: our_funding_satoshis,
1087510875
their_funding_satoshis: Some(msg.common_fields.funding_satoshis),
1087610876
funding_tx_locktime: LockTime::from_consensus(msg.locktime),
@@ -10884,8 +10884,8 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1088410884
holder_node_id,
1088510885
counterparty_node_id,
1088610886
channel_id: context.channel_id,
10887-
feerate_sat_per_kw: dual_funding_context.funding_feerate_sat_per_1000_weight,
10888-
funding_tx_locktime: dual_funding_context.funding_tx_locktime,
10887+
feerate_sat_per_kw: funding_negotiation_context.funding_feerate_sat_per_1000_weight,
10888+
funding_tx_locktime: funding_negotiation_context.funding_tx_locktime,
1088910889
is_initiator: false,
1089010890
inputs_to_contribute: our_funding_inputs,
1089110891
outputs_to_contribute: Vec::new(),
@@ -10903,7 +10903,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1090310903
Ok(Self {
1090410904
funding,
1090510905
context,
10906-
dual_funding_context,
10906+
funding_negotiation_context,
1090710907
interactive_tx_constructor,
1090810908
interactive_tx_signing_session: None,
1090910909
unfunded_context,
@@ -10968,7 +10968,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1096810968
}),
1096910969
channel_type: Some(self.funding.get_channel_type().clone()),
1097010970
},
10971-
funding_satoshis: self.dual_funding_context.our_funding_satoshis,
10971+
funding_satoshis: self.funding_negotiation_context.our_funding_satoshis,
1097210972
second_per_commitment_point,
1097310973
require_confirmed_inputs: None,
1097410974
}

lightning/src/ln/channelmanager.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8042,7 +8042,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
80428042

80438043
// Inbound V2 channels with contributed inputs are not considered unfunded.
80448044
if let Some(unfunded_chan) = chan.as_unfunded_v2() {
8045-
if unfunded_chan.dual_funding_context.our_funding_satoshis != 0 {
8045+
if unfunded_chan.funding_negotiation_context.our_funding_satoshis != 0 {
80468046
continue;
80478047
}
80488048
}

0 commit comments

Comments
 (0)