Remove redundant `startup_replay` arg to `claim_funds_internal`
What changed, and why it matters
This is a small internal code cleanup in the Lightning Dev Kit's channel manager. It removes a redundant function argument and replaces it with a direct read of an existing flag. The change does not alter behavior and is not a security fix.
No security action needed. Treat as a normal code-quality refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors claim_funds_internal in lightning/src/ln/channelmanager.rs by removing the startup_replay: bool parameter. Previously, callers passed this value and a debug_assert_eq! checked that it matched !self.background_events_processed_since_startup.load(Ordering::Acquire). The patch removes the parameter and the assertion, instead computing startup_replay directly from the atomic flag inside the function. All call sites are updated to remove the now-unnecessary argument. This is a pure refactoring with no functional change.
Changed components
lightning/src/ln/channelmanager.rsInspect captured patch +5 / −11
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index d378f44..ff1f835 100644
--- a/lightning/src/ln/channelmanager.rs
+++ b/lightning/src/ln/channelmanager.rs
@@ -8653,15 +8653,12 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
fn claim_funds_internal(
&self, source: HTLCSource, payment_preimage: PaymentPreimage,
forwarded_htlc_value_msat: Option<u64>, skimmed_fee_msat: Option<u64>, from_onchain: bool,
- startup_replay: bool, next_channel_counterparty_node_id: PublicKey,
- next_channel_outpoint: OutPoint, next_channel_id: ChannelId,
- next_user_channel_id: Option<u128>, attribution_data: Option<AttributionData>,
- send_timestamp: Option<Duration>,
+ next_channel_counterparty_node_id: PublicKey, next_channel_outpoint: OutPoint,
+ next_channel_id: ChannelId, next_user_channel_id: Option<u128>,
+ attribution_data: Option<AttributionData>, send_timestamp: Option<Duration>,
) {
- debug_assert_eq!(
- startup_replay,
- !self.background_events_processed_since_startup.load(Ordering::Acquire)
- );
+ let startup_replay =
+ !self.background_events_processed_since_startup.load(Ordering::Acquire);
let htlc_id = SentHTLCId::from_source(&source);
match source {
HTLCSource::OutboundRoute {
@@ -10509,7 +10506,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
Some(forwarded_htlc_value),
skimmed_fee_msat,
false,
- false,
*counterparty_node_id,
funding_txo,
msg.channel_id,
@@ -11383,7 +11379,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
htlc_update.htlc_value_satoshis.map(|v| v * 1000),
None,
true,
- false,
counterparty_node_id,
funding_outpoint,
channel_id,
@@ -17497,7 +17492,6 @@ where
Some(downstream_value),
None,
downstream_closed,
- true,
downstream_node_id,
downstream_funding,
downstream_channel_id,
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.