Skip to content

Commit 07651d5

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 7b62ea4 commit 07651d5

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
@@ -2448,7 +2448,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
24482448
debug_assert!(self.interactive_tx_constructor.is_none());
24492449

24502450
let mut funding_inputs = Vec::new();
2451-
mem::swap(&mut self.dual_funding_context.our_funding_inputs, &mut funding_inputs);
2451+
mem::swap(&mut self.funding_negotiation_context.our_funding_inputs, &mut funding_inputs);
24522452

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

@@ -2466,7 +2466,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
24662466
if self.funding.is_outbound() {
24672467
funding_outputs.push(
24682468
OutputOwned::Shared(SharedOwnedOutput::new(
2469-
shared_funding_output, self.dual_funding_context.our_funding_satoshis,
2469+
shared_funding_output, self.funding_negotiation_context.our_funding_satoshis,
24702470
))
24712471
);
24722472
} else {
@@ -2482,9 +2482,9 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
24822482
.map_err(|_err| AbortReason::InternalError("Error getting destination script"))?
24832483
};
24842484
let change_value_opt = calculate_change_output_value(
2485-
self.funding.is_outbound(), self.dual_funding_context.our_funding_satoshis,
2485+
self.funding.is_outbound(), self.funding_negotiation_context.our_funding_satoshis,
24862486
&funding_inputs, &funding_outputs,
2487-
self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2487+
self.funding_negotiation_context.funding_feerate_sat_per_1000_weight,
24882488
change_script.minimal_non_dust().to_sat(),
24892489
)?;
24902490
if let Some(change_value) = change_value_opt {
@@ -2493,7 +2493,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
24932493
script_pubkey: change_script,
24942494
};
24952495
let change_output_weight = get_output_weight(&change_output.script_pubkey).to_wu();
2496-
let change_output_fee = fee_for_weight(self.dual_funding_context.funding_feerate_sat_per_1000_weight, change_output_weight);
2496+
let change_output_fee = fee_for_weight(self.funding_negotiation_context.funding_feerate_sat_per_1000_weight, change_output_weight);
24972497
let change_value_decreased_with_fee = change_value.saturating_sub(change_output_fee);
24982498
// Check dust limit again
24992499
if change_value_decreased_with_fee > self.context.holder_dust_limit_satoshis {
@@ -2507,9 +2507,9 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
25072507
holder_node_id,
25082508
counterparty_node_id: self.context.counterparty_node_id,
25092509
channel_id: self.context.channel_id(),
2510-
feerate_sat_per_kw: self.dual_funding_context.funding_feerate_sat_per_1000_weight,
2510+
feerate_sat_per_kw: self.funding_negotiation_context.funding_feerate_sat_per_1000_weight,
25112511
is_initiator: self.funding.is_outbound(),
2512-
funding_tx_locktime: self.dual_funding_context.funding_tx_locktime,
2512+
funding_tx_locktime: self.funding_negotiation_context.funding_tx_locktime,
25132513
inputs_to_contribute: funding_inputs,
25142514
outputs_to_contribute: funding_outputs,
25152515
expected_remote_shared_funding_output,
@@ -2594,7 +2594,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
25942594
where
25952595
L::Target: Logger
25962596
{
2597-
let our_funding_satoshis = self.dual_funding_context.our_funding_satoshis;
2597+
let our_funding_satoshis = self.funding_negotiation_context.our_funding_satoshis;
25982598
let transaction_number = self.unfunded_context.transaction_number();
25992599

26002600
let mut output_index = None;
@@ -5136,8 +5136,8 @@ fn check_v2_funding_inputs_sufficient(
51365136
}
51375137
}
51385138

5139-
/// Context for dual-funded channels.
5140-
pub(super) struct DualFundingChannelContext {
5139+
/// Context for negotiating channels (dual-funded V2 open, splicing)
5140+
pub(super) struct FundingNegotiationContext {
51415141
/// The amount in satoshis we will be contributing to the channel.
51425142
pub our_funding_satoshis: u64,
51435143
/// The amount in satoshis our counterparty will be contributing to the channel.
@@ -10323,7 +10323,7 @@ pub(super) struct PendingV2Channel<SP: Deref> where SP::Target: SignerProvider {
1032310323
pub funding: FundingScope,
1032410324
pub context: ChannelContext<SP>,
1032510325
pub unfunded_context: UnfundedChannelContext,
10326-
pub dual_funding_context: DualFundingChannelContext,
10326+
pub funding_negotiation_context: FundingNegotiationContext,
1032710327
/// The current interactive transaction construction session under negotiation.
1032810328
pub interactive_tx_constructor: Option<InteractiveTxConstructor>,
1032910329
/// The signing session created after `tx_complete` handling
@@ -10382,7 +10382,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1038210382
unfunded_channel_age_ticks: 0,
1038310383
holder_commitment_point: HolderCommitmentPoint::new(&context.holder_signer, &context.secp_ctx),
1038410384
};
10385-
let dual_funding_context = DualFundingChannelContext {
10385+
let funding_negotiation_context = FundingNegotiationContext {
1038610386
our_funding_satoshis: funding_satoshis,
1038710387
// TODO(dual_funding) TODO(splicing) Include counterparty contribution, once that's enabled
1038810388
their_funding_satoshis: None,
@@ -10394,7 +10394,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1039410394
funding,
1039510395
context,
1039610396
unfunded_context,
10397-
dual_funding_context,
10397+
funding_negotiation_context,
1039810398
interactive_tx_constructor: None,
1039910399
interactive_tx_signing_session: None,
1040010400
};
@@ -10463,7 +10463,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1046310463
},
1046410464
funding_feerate_sat_per_1000_weight: self.context.feerate_per_kw,
1046510465
second_per_commitment_point,
10466-
locktime: self.dual_funding_context.funding_tx_locktime.to_consensus_u32(),
10466+
locktime: self.funding_negotiation_context.funding_tx_locktime.to_consensus_u32(),
1046710467
require_confirmed_inputs: None,
1046810468
}
1046910469
}
@@ -10534,7 +10534,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1053410534
&funding.get_counterparty_pubkeys().revocation_basepoint);
1053510535
context.channel_id = channel_id;
1053610536

10537-
let dual_funding_context = DualFundingChannelContext {
10537+
let funding_negotiation_context = FundingNegotiationContext {
1053810538
our_funding_satoshis: our_funding_satoshis,
1053910539
their_funding_satoshis: Some(msg.common_fields.funding_satoshis),
1054010540
funding_tx_locktime: LockTime::from_consensus(msg.locktime),
@@ -10548,8 +10548,8 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1054810548
holder_node_id,
1054910549
counterparty_node_id,
1055010550
channel_id: context.channel_id,
10551-
feerate_sat_per_kw: dual_funding_context.funding_feerate_sat_per_1000_weight,
10552-
funding_tx_locktime: dual_funding_context.funding_tx_locktime,
10551+
feerate_sat_per_kw: funding_negotiation_context.funding_feerate_sat_per_1000_weight,
10552+
funding_tx_locktime: funding_negotiation_context.funding_tx_locktime,
1055310553
is_initiator: false,
1055410554
inputs_to_contribute: our_funding_inputs,
1055510555
outputs_to_contribute: Vec::new(),
@@ -10567,7 +10567,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1056710567
Ok(Self {
1056810568
funding,
1056910569
context,
10570-
dual_funding_context,
10570+
funding_negotiation_context,
1057110571
interactive_tx_constructor,
1057210572
interactive_tx_signing_session: None,
1057310573
unfunded_context,
@@ -10632,7 +10632,7 @@ impl<SP: Deref> PendingV2Channel<SP> where SP::Target: SignerProvider {
1063210632
}),
1063310633
channel_type: Some(self.funding.get_channel_type().clone()),
1063410634
},
10635-
funding_satoshis: self.dual_funding_context.our_funding_satoshis,
10635+
funding_satoshis: self.funding_negotiation_context.our_funding_satoshis,
1063610636
second_per_commitment_point,
1063710637
require_confirmed_inputs: None,
1063810638
}

lightning/src/ln/channelmanager.rs

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

82568256
// Inbound V2 channels with contributed inputs are not considered unfunded.
82578257
if let Some(unfunded_chan) = chan.as_unfunded_v2() {
8258-
if unfunded_chan.dual_funding_context.our_funding_satoshis != 0 {
8258+
if unfunded_chan.funding_negotiation_context.our_funding_satoshis != 0 {
82598259
continue;
82608260
}
82618261
}

0 commit comments

Comments
 (0)