Skip to content

Commit 79b8083

Browse files
committed
fix Minor changes, removed check, etc
1 parent b5a46c7 commit 79b8083

File tree

2 files changed

+23
-34
lines changed

2 files changed

+23
-34
lines changed

lightning/src/ln/channel.rs

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,6 +2199,7 @@ impl FundingScope {
21992199
let post_value_to_self_msat = post_value_to_self_msat_signed as u64;
22002200

22012201
let prev_funding_txid = prev_funding.get_funding_txid();
2202+
// Update the splicing 'tweak', this will rotate the keys in the signer
22022203
let holder_pubkeys = match &context.holder_signer {
22032204
ChannelSignerType::Ecdsa(ecdsa) => ecdsa.pubkeys(prev_funding_txid, &context.secp_ctx),
22042205
// TODO (taproot|arik)
@@ -2217,7 +2218,6 @@ impl FundingScope {
22172218
channel_type_features: channel_parameters.channel_type_features.clone(),
22182219
channel_value_satoshis: post_channel_value,
22192220
};
2220-
// Update the splicing 'tweak', this will rotate the keys in the signer
22212221
if let Some(ref mut counterparty_parameters) =
22222222
post_channel_transaction_parameters.counterparty_parameters
22232223
{
@@ -2880,6 +2880,8 @@ where
28802880
SP::Target: SignerProvider,
28812881
{
28822882
context: &'a mut ChannelContext<SP>,
2883+
/// The funding scope being (re)negotiated.
2884+
/// In case of splicing it is the new spliced scope.
28832885
funding: &'a mut FundingScope,
28842886
funding_negotiation_context: &'a mut FundingNegotiationContext,
28852887
interactive_tx_constructor: &'a mut Option<InteractiveTxConstructor>,
@@ -3129,8 +3131,6 @@ where
31293131
let commitment_signed = self.context.get_initial_commitment_signed(&self.funding, logger);
31303132
let commitment_signed = match commitment_signed {
31313133
Ok(commitment_signed) => {
3132-
self.funding
3133-
.funding_transaction = Some(signing_session.unsigned_tx().build_unsigned_tx());
31343134
commitment_signed
31353135
},
31363136
Err(err) => {
@@ -6226,29 +6226,18 @@ where
62266226
#[cfg(splicing)]
62276227
fn as_renegotiating_channel(&mut self) -> Result<NegotiatingChannelView<SP>, &'static str> {
62286228
if let Some(ref mut pending_splice) = &mut self.pending_splice {
6229-
if let Some(ref mut funding) = &mut pending_splice.funding {
6230-
if pending_splice.funding_negotiation_context.our_funding_satoshis != 0
6231-
|| pending_splice
6232-
.funding_negotiation_context
6233-
.their_funding_satoshis
6234-
.unwrap_or_default() != 0
6235-
{
6236-
Ok(NegotiatingChannelView {
6237-
context: &mut self.context,
6238-
funding,
6239-
funding_negotiation_context: &mut pending_splice
6240-
.funding_negotiation_context,
6241-
interactive_tx_constructor: &mut pending_splice.interactive_tx_constructor,
6242-
interactive_tx_signing_session: &mut pending_splice
6243-
.interactive_tx_signing_session,
6244-
holder_commitment_transaction_number: self
6245-
.holder_commitment_point
6246-
.transaction_number(),
6247-
})
6248-
} else {
6249-
Err("Received unexpected interactive transaction negotiation message: \
6250-
the channel is splicing, but splice_init/splice_ack has not been exchanged yet")
6251-
}
6229+
if let Some(ref mut funding) = &mut pending_splice.funding_scope {
6230+
Ok(NegotiatingChannelView {
6231+
context: &mut self.context,
6232+
funding,
6233+
funding_negotiation_context: &mut pending_splice.funding_negotiation_context,
6234+
interactive_tx_constructor: &mut pending_splice.interactive_tx_constructor,
6235+
interactive_tx_signing_session: &mut pending_splice
6236+
.interactive_tx_signing_session,
6237+
holder_commitment_transaction_number: self
6238+
.holder_commitment_point
6239+
.transaction_number(),
6240+
})
62526241
} else {
62536242
Err("Received unexpected interactive transaction negotiation message: \
62546243
the channel is splicing, but splice_init/splice_ack has not been exchanged yet")
@@ -10478,9 +10467,9 @@ where
1047810467
// Convert inputs
1047910468
let mut funding_inputs = Vec::new();
1048010469
for (tx_in, tx, _w) in our_funding_inputs.into_iter() {
10481-
let tx16 = TransactionU16LenLimited::new(tx.clone())
10470+
let tx16 = TransactionU16LenLimited::new(tx)
1048210471
.map_err(|_e| APIError::APIMisuseError { err: format!("Too large transaction") })?;
10483-
funding_inputs.push((tx_in.clone(), tx16));
10472+
funding_inputs.push((tx_in, tx16));
1048410473
}
1048510474

1048610475
let funding_negotiation_context = FundingNegotiationContext {

lightning/src/ln/channelmanager.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4525,7 +4525,7 @@ where
45254525
let mut res = Ok(());
45264526
PersistenceNotifierGuard::optionally_notify(self, || {
45274527
let result = self.internal_splice_channel(
4528-
channel_id, counterparty_node_id, our_funding_contribution_satoshis, our_funding_inputs.clone(), funding_feerate_per_kw, locktime
4528+
channel_id, counterparty_node_id, our_funding_contribution_satoshis, our_funding_inputs, funding_feerate_per_kw, locktime
45294529
);
45304530
res = result;
45314531
match res {
@@ -10163,11 +10163,11 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1016310163
), msg.channel_id)),
1016410164
hash_map::Entry::Occupied(mut chan_entry) => {
1016510165
if let Some(ref mut funded_channel) = chan_entry.get_mut().as_funded_mut() {
10166-
let tx_msg_opt = try_channel_entry!(self, peer_state,
10167-
funded_channel.splice_ack(
10168-
msg, &self.signer_provider, &self.entropy_source,
10169-
&self.get_our_node_id(), &self.logger
10170-
), chan_entry);
10166+
let splice_ack_res = funded_channel.splice_ack(
10167+
msg, &self.signer_provider, &self.entropy_source,
10168+
&self.get_our_node_id(), &self.logger
10169+
);
10170+
let tx_msg_opt = try_channel_entry!(self, peer_state, splice_ack_res, chan_entry);
1017110171
if let Some(tx_msg) = tx_msg_opt {
1017210172
peer_state.pending_msg_events.push(tx_msg.into_msg_send_event(counterparty_node_id.clone()));
1017310173
}

0 commit comments

Comments
 (0)