Skip to content

Commit

Permalink
nit cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
tankyleo committed Feb 22, 2025
1 parent c1e26b3 commit 7fc689d
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3347,8 +3347,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
}
}

let mut inbound_htlc_preimages: Vec<PaymentPreimage> = Vec::new();

let mut htlcs_in_tx = Vec::new();

for ref htlc in self.pending_inbound_htlcs.iter() {
Expand All @@ -3368,8 +3366,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
match &htlc.state {
&InboundHTLCState::LocalRemoved(ref reason) => {
if generated_by_local {
if let &InboundHTLCRemovalReason::Fulfill(preimage) = reason {
inbound_htlc_preimages.push(preimage);
if let &InboundHTLCRemovalReason::Fulfill(_preimage) = reason {
value_to_self_msat_offset += htlc.amount_msat as i64;
}
}
Expand All @@ -3379,9 +3376,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
}
}


let mut outbound_htlc_preimages: Vec<PaymentPreimage> = Vec::new();

for ref htlc in self.pending_outbound_htlcs.iter() {
let (include, state_name) = match htlc.state {
OutboundHTLCState::LocalAnnounced(_) => (generated_by_local, "LocalAnnounced"),
Expand All @@ -3391,17 +3385,6 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
OutboundHTLCState::AwaitingRemovedRemoteRevoke(_) => (false, "AwaitingRemovedRemoteRevoke"),
};

let preimage_opt = match htlc.state {
OutboundHTLCState::RemoteRemoved(OutboundHTLCOutcome::Success(p)) => p,
OutboundHTLCState::AwaitingRemoteRevokeToRemove(OutboundHTLCOutcome::Success(p)) => p,
OutboundHTLCState::AwaitingRemovedRemoteRevoke(OutboundHTLCOutcome::Success(p)) => p,
_ => None,
};

if let Some(preimage) = preimage_opt {
outbound_htlc_preimages.push(preimage);
}

if include {
let htlc_in_tx = get_htlc_in_commitment!(htlc, local);
htlcs_in_tx.push((htlc_in_tx, Some(&htlc.source)));
Expand All @@ -3420,13 +3403,12 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
}
}
}
let value_to_self_msat: i64 = self.value_to_self_msat as i64 + value_to_self_msat_offset;

let value_to_self_msat: i64 = self.value_to_self_msat as i64 + value_to_self_msat_offset;

use crate::sign::tx_builder::SpecTxBuilder;
use crate::sign::tx_builder::TxBuilder;
let tx_builder = SpecTxBuilder {};

tx_builder.build_commitment_transaction(local, commitment_number, &keys.per_commitment_point, &self.channel_transaction_parameters, &self.secp_ctx, self.channel_value_satoshis, value_to_self_msat, htlcs_in_tx, feerate_per_kw, broadcaster_dust_limit_satoshis)
}

Expand Down

0 comments on commit 7fc689d

Please sign in to comment.