Skip to content

Commit 0afb374

Browse files
committed
fix Minor changes, removed check, etc
1 parent 586a094 commit 0afb374

File tree

2 files changed

+22
-33
lines changed

2 files changed

+22
-33
lines changed

lightning/src/ln/channel.rs

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,6 +2172,7 @@ impl FundingScope {
21722172
let post_value_to_self_msat = post_value_to_self_msat_signed as u64;
21732173

21742174
let prev_funding_txid = prev_funding.get_funding_txid();
2175+
// Update the splicing 'tweak', this will rotate the keys in the signer
21752176
let holder_pubkeys = match &context.holder_signer {
21762177
ChannelSignerType::Ecdsa(ecdsa) => ecdsa.pubkeys(prev_funding_txid, &context.secp_ctx),
21772178
// TODO (taproot|arik)
@@ -2190,7 +2191,6 @@ impl FundingScope {
21902191
channel_type_features: channel_parameters.channel_type_features.clone(),
21912192
channel_value_satoshis: post_channel_value,
21922193
};
2193-
// Update the splicing 'tweak', this will rotate the keys in the signer
21942194
if let Some(ref mut counterparty_parameters) =
21952195
post_channel_transaction_parameters.counterparty_parameters
21962196
{
@@ -2853,6 +2853,8 @@ where
28532853
SP::Target: SignerProvider,
28542854
{
28552855
context: &'a mut ChannelContext<SP>,
2856+
/// The funding scope being (re)negotiated.
2857+
/// In case of splicing it is the new spliced scope.
28562858
funding: &'a mut FundingScope,
28572859
funding_negotiation_context: &'a mut FundingNegotiationContext,
28582860
interactive_tx_constructor: &'a mut Option<InteractiveTxConstructor>,
@@ -3102,8 +3104,6 @@ where
31023104
let commitment_signed = self.context.get_initial_commitment_signed(&self.funding, logger);
31033105
let commitment_signed = match commitment_signed {
31043106
Ok(commitment_signed) => {
3105-
self.funding
3106-
.funding_transaction = Some(signing_session.unsigned_tx().build_unsigned_tx());
31073107
commitment_signed
31083108
},
31093109
Err(err) => {
@@ -6193,28 +6193,17 @@ where
61936193
fn as_renegotiating_channel(&mut self) -> Result<NegotiatingChannelView<SP>, &'static str> {
61946194
if let Some(ref mut pending_splice) = &mut self.pending_splice {
61956195
if let Some(ref mut funding) = &mut pending_splice.funding_scope {
6196-
if pending_splice.funding_negotiation_context.our_funding_satoshis != 0
6197-
|| pending_splice
6198-
.funding_negotiation_context
6199-
.their_funding_satoshis
6200-
.unwrap_or_default() != 0
6201-
{
6202-
Ok(NegotiatingChannelView {
6203-
context: &mut self.context,
6204-
funding,
6205-
funding_negotiation_context: &mut pending_splice
6206-
.funding_negotiation_context,
6207-
interactive_tx_constructor: &mut pending_splice.interactive_tx_constructor,
6208-
interactive_tx_signing_session: &mut pending_splice
6209-
.interactive_tx_signing_session,
6210-
holder_commitment_transaction_number: self
6211-
.holder_commitment_point
6212-
.transaction_number(),
6213-
})
6214-
} else {
6215-
Err("Received unexpected interactive transaction negotiation message: \
6216-
the channel is splicing, but splice_init/splice_ack has not been exchanged yet")
6217-
}
6196+
Ok(NegotiatingChannelView {
6197+
context: &mut self.context,
6198+
funding,
6199+
funding_negotiation_context: &mut pending_splice.funding_negotiation_context,
6200+
interactive_tx_constructor: &mut pending_splice.interactive_tx_constructor,
6201+
interactive_tx_signing_session: &mut pending_splice
6202+
.interactive_tx_signing_session,
6203+
holder_commitment_transaction_number: self
6204+
.holder_commitment_point
6205+
.transaction_number(),
6206+
})
62186207
} else {
62196208
Err("Received unexpected interactive transaction negotiation message: \
62206209
the channel is splicing, but splice_init/splice_ack has not been exchanged yet")
@@ -10247,9 +10236,9 @@ where
1024710236
// Convert inputs
1024810237
let mut funding_inputs = Vec::new();
1024910238
for (tx_in, tx, _w) in our_funding_inputs.into_iter() {
10250-
let tx16 = TransactionU16LenLimited::new(tx.clone())
10239+
let tx16 = TransactionU16LenLimited::new(tx)
1025110240
.map_err(|_e| APIError::APIMisuseError { err: format!("Too large transaction") })?;
10252-
funding_inputs.push((tx_in.clone(), tx16));
10241+
funding_inputs.push((tx_in, tx16));
1025310242
}
1025410243

1025510244
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)