Skip to content

Commit 5c25bf7

Browse files
committed
Remove redundant startup_replay arg to claim_funds_internal
`startup_replay` should always exactly mirror `background_events_processed_since_startup`, so we should just use that rather than having a dedicated argument for it. Backport of 77026c9 Fixed conflicts in: * lightning/src/ln/channelmanager.rs
1 parent d8ac152 commit 5c25bf7

File tree

1 file changed

+34
-14
lines changed

1 file changed

+34
-14
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7412,13 +7412,11 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
74127412

74137413
fn claim_funds_internal(&self, source: HTLCSource, payment_preimage: PaymentPreimage,
74147414
forwarded_htlc_value_msat: Option<u64>, skimmed_fee_msat: Option<u64>, from_onchain: bool,
7415-
startup_replay: bool, next_channel_counterparty_node_id: Option<PublicKey>,
7415+
next_channel_counterparty_node_id: Option<PublicKey>,
74167416
next_channel_outpoint: OutPoint, next_channel_id: ChannelId, next_user_channel_id: Option<u128>,
74177417
) {
7418-
debug_assert_eq!(
7419-
startup_replay,
7420-
!self.background_events_processed_since_startup.load(Ordering::Acquire)
7421-
);
7418+
let startup_replay =
7419+
!self.background_events_processed_since_startup.load(Ordering::Acquire);
74227420
let htlc_id = SentHTLCId::from_source(&source);
74237421
match source {
74247422
HTLCSource::OutboundRoute { session_priv, payment_id, path, .. } => {
@@ -9010,9 +9008,16 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
90109008
hash_map::Entry::Vacant(_) => return Err(MsgHandleErrInternal::send_err_msg_no_close(format!("Got a message for a channel from the wrong node! No such channel for the passed counterparty_node_id {}", counterparty_node_id), msg.channel_id))
90119009
}
90129010
};
9013-
self.claim_funds_internal(htlc_source, msg.payment_preimage.clone(),
9014-
Some(forwarded_htlc_value), skimmed_fee_msat, false, false, Some(*counterparty_node_id),
9015-
funding_txo, msg.channel_id, Some(next_user_channel_id),
9011+
self.claim_funds_internal(
9012+
htlc_source,
9013+
msg.payment_preimage.clone(),
9014+
Some(forwarded_htlc_value),
9015+
skimmed_fee_msat,
9016+
false,
9017+
Some(*counterparty_node_id),
9018+
funding_txo,
9019+
msg.channel_id,
9020+
Some(next_user_channel_id),
90169021
);
90179022

90189023
Ok(())
@@ -9565,9 +9570,17 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
95659570
let logger = WithContext::from(&self.logger, counterparty_node_id, Some(channel_id), Some(htlc_update.payment_hash));
95669571
if let Some(preimage) = htlc_update.payment_preimage {
95679572
log_trace!(logger, "Claiming HTLC with preimage {} from our monitor", preimage);
9568-
self.claim_funds_internal(htlc_update.source, preimage,
9569-
htlc_update.htlc_value_satoshis.map(|v| v * 1000), None, true,
9570-
false, counterparty_node_id, funding_outpoint, channel_id, None);
9573+
self.claim_funds_internal(
9574+
htlc_update.source,
9575+
preimage,
9576+
htlc_update.htlc_value_satoshis.map(|v| v * 1000),
9577+
None,
9578+
true,
9579+
counterparty_node_id,
9580+
funding_outpoint,
9581+
channel_id,
9582+
None,
9583+
);
95719584
} else {
95729585
log_trace!(logger, "Failing HTLC with hash {} from our monitor", &htlc_update.payment_hash);
95739586
let receiver = HTLCDestination::NextHopChannel { node_id: counterparty_node_id, channel_id };
@@ -14833,9 +14846,16 @@ where
1483314846
// We use `downstream_closed` in place of `from_onchain` here just as a guess - we
1483414847
// don't remember in the `ChannelMonitor` where we got a preimage from, but if the
1483514848
// channel is closed we just assume that it probably came from an on-chain claim.
14836-
channel_manager.claim_funds_internal(source, preimage, Some(downstream_value), None,
14837-
downstream_closed, true, downstream_node_id, downstream_funding,
14838-
downstream_channel_id, None
14849+
channel_manager.claim_funds_internal(
14850+
source,
14851+
preimage,
14852+
Some(downstream_value),
14853+
None,
14854+
downstream_closed,
14855+
downstream_node_id,
14856+
downstream_funding,
14857+
downstream_channel_id,
14858+
None,
1483914859
);
1484014860
}
1484114861

0 commit comments

Comments
 (0)