Skip to content

Commit 128bf86

Browse files
committed
f set_interactive_tx_constructor was useless (for now) lol
1 parent d608783 commit 128bf86

File tree

1 file changed

+22
-37
lines changed

1 file changed

+22
-37
lines changed

lightning/src/ln/channel.rs

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,8 +1651,6 @@ pub(super) trait InteractivelyFunded<SP: Deref> where SP::Target: SignerProvider
16511651

16521652
fn dual_funding_context(&self) -> &DualFundingChannelContext;
16531653

1654-
fn set_interactive_tx_constructor(&mut self, interactive_tx_constructor: InteractiveTxConstructor);
1655-
16561654
fn tx_add_input(&mut self, msg: &msgs::TxAddInput) -> InteractiveTxMessageSendResult {
16571655
InteractiveTxMessageSendResult(match self.interactive_tx_constructor_mut() {
16581656
Some(ref mut tx_constructor) => tx_constructor.handle_tx_add_input(msg).map_err(
@@ -1722,9 +1720,6 @@ impl<SP: Deref> InteractivelyFunded<SP> for OutboundV2Channel<SP> where SP::Targ
17221720
fn interactive_tx_constructor_mut(&mut self) -> &mut Option<InteractiveTxConstructor> {
17231721
&mut self.interactive_tx_constructor
17241722
}
1725-
fn set_interactive_tx_constructor(&mut self, interactive_tx_constructor: InteractiveTxConstructor) {
1726-
self.interactive_tx_constructor = Some(interactive_tx_constructor);
1727-
}
17281723
}
17291724

17301725
impl<SP: Deref> InteractivelyFunded<SP> for InboundV2Channel<SP> where SP::Target: SignerProvider {
@@ -1740,9 +1735,6 @@ impl<SP: Deref> InteractivelyFunded<SP> for InboundV2Channel<SP> where SP::Targe
17401735
fn interactive_tx_constructor_mut(&mut self) -> &mut Option<InteractiveTxConstructor> {
17411736
&mut self.interactive_tx_constructor
17421737
}
1743-
fn set_interactive_tx_constructor(&mut self, interactive_tx_constructor: InteractiveTxConstructor) {
1744-
self.interactive_tx_constructor = Some(interactive_tx_constructor);
1745-
}
17461738
}
17471739

17481740
impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
@@ -8624,43 +8616,36 @@ impl<SP: Deref> InboundV2Channel<SP> where SP::Target: SignerProvider {
86248616
&context.get_counterparty_pubkeys().revocation_basepoint);
86258617
context.channel_id = channel_id;
86268618

8627-
let mut channel = Self {
8628-
context,
8629-
unfunded_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 },
8630-
dual_funding_context: DualFundingChannelContext {
8631-
our_funding_satoshis: funding_satoshis,
8632-
their_funding_satoshis: msg.common_fields.funding_satoshis,
8633-
funding_tx_locktime: LockTime::from_consensus(msg.locktime),
8634-
funding_feerate_sat_per_1000_weight: msg.funding_feerate_sat_per_1000_weight,
8635-
our_funding_inputs: funding_inputs,
8636-
},
8637-
interactive_tx_constructor: None,
8619+
let dual_funding_context = DualFundingChannelContext {
8620+
our_funding_satoshis: funding_satoshis,
8621+
their_funding_satoshis: msg.common_fields.funding_satoshis,
8622+
funding_tx_locktime: LockTime::from_consensus(msg.locktime),
8623+
funding_feerate_sat_per_1000_weight: msg.funding_feerate_sat_per_1000_weight,
8624+
our_funding_inputs: funding_inputs,
86388625
};
86398626

8640-
match InteractiveTxConstructor::new(
8627+
let interactive_tx_constructor = Some(InteractiveTxConstructor::new(
86418628
InteractiveTxConstructorArgs {
86428629
entropy_source,
8643-
channel_id: channel.context.channel_id,
8644-
feerate_sat_per_kw: channel.dual_funding_context.funding_feerate_sat_per_1000_weight,
8645-
funding_tx_locktime: channel.dual_funding_context.funding_tx_locktime,
8630+
channel_id: context.channel_id,
8631+
feerate_sat_per_kw: dual_funding_context.funding_feerate_sat_per_1000_weight,
8632+
funding_tx_locktime: dual_funding_context.funding_tx_locktime,
86468633
is_initiator: false,
8647-
inputs_to_contribute: channel.dual_funding_context.our_funding_inputs.clone(),
8634+
inputs_to_contribute: dual_funding_context.our_funding_inputs.clone(),
86488635
outputs_to_contribute: Vec::new(),
8649-
expected_remote_shared_funding_output: Some((channel.context().get_funding_redeemscript(), channel.context().channel_value_satoshis)),
8636+
expected_remote_shared_funding_output: Some((context.get_funding_redeemscript(), context.channel_value_satoshis)),
86508637
}
8651-
) {
8652-
Ok(tx_constructor) => {
8653-
channel.set_interactive_tx_constructor(tx_constructor);
8654-
},
8655-
Err(_) => {
8656-
return Err(ChannelError::Close((
8657-
"V2 channel rejected due to sender error".into(),
8658-
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) },
8659-
)))
8660-
}
8661-
}
8638+
).map_err(|_| ChannelError::Close((
8639+
"V2 channel rejected due to sender error".into(),
8640+
ClosureReason::HolderForceClosed { broadcasted_latest_txn: Some(false) }
8641+
)))?);
86628642

8663-
Ok(channel)
8643+
Ok(Self {
8644+
context,
8645+
dual_funding_context,
8646+
interactive_tx_constructor,
8647+
unfunded_context: UnfundedChannelContext { unfunded_channel_age_ticks: 0 },
8648+
})
86648649
}
86658650

86668651
/// Marks an inbound channel as accepted and generates a [`msgs::AcceptChannelV2`] message which

0 commit comments

Comments
 (0)