Skip to content

Commit 7f5b830

Browse files
Delete now-unused MonitorRestoreUpdates::accepted_htlcs
We stopped adding any HTLCs to this vec a few commits ago when we removed support for HTLCs that were originally received on LDK 0.0.123-.
1 parent cc57595 commit 7f5b830

File tree

2 files changed

+17
-35
lines changed

2 files changed

+17
-35
lines changed

lightning/src/ln/channel.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ use crate::ln::channel_state::{
5151
};
5252
use crate::ln::channelmanager::{
5353
self, ChannelReadyOrder, FundingConfirmedMessage, HTLCPreviousHopData, HTLCSource,
54-
OpenChannelMessage, PaymentClaimDetails, PendingHTLCInfo, RAACommitmentOrder, SentHTLCId,
55-
BREAKDOWN_TIMEOUT, MAX_LOCAL_BREAKDOWN_TIMEOUT, MIN_CLTV_EXPIRY_DELTA,
54+
OpenChannelMessage, PaymentClaimDetails, RAACommitmentOrder, SentHTLCId, BREAKDOWN_TIMEOUT,
55+
MAX_LOCAL_BREAKDOWN_TIMEOUT, MIN_CLTV_EXPIRY_DELTA,
5656
};
5757
use crate::ln::funding::{FundingTxInput, SpliceContribution};
5858
use crate::ln::interactivetxs::{
@@ -1122,8 +1122,6 @@ pub(super) struct MonitorRestoreUpdates {
11221122
// A `CommitmentUpdate` to be sent to our channel peer.
11231123
pub commitment_update: Option<msgs::CommitmentUpdate>,
11241124
pub commitment_order: RAACommitmentOrder,
1125-
// TODO: get rid of this
1126-
pub accepted_htlcs: Vec<(PendingHTLCInfo, u64)>,
11271125
pub failed_htlcs: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
11281126
pub finalized_claimed_htlcs: Vec<(HTLCSource, Option<AttributionData>)>,
11291127
// Inbound update_adds that are now irrevocably committed to this channel and are ready for the
@@ -9425,9 +9423,9 @@ where
94259423
self.context.monitor_pending_commitment_signed = false;
94269424
return MonitorRestoreUpdates {
94279425
raa: None, commitment_update: None, commitment_order: RAACommitmentOrder::RevokeAndACKFirst,
9428-
accepted_htlcs: Vec::new(), failed_htlcs, finalized_claimed_htlcs, pending_update_adds,
9429-
funding_broadcastable, channel_ready, announcement_sigs, tx_signatures: None,
9430-
channel_ready_order, committed_outbound_htlc_sources
9426+
failed_htlcs, finalized_claimed_htlcs, pending_update_adds, funding_broadcastable,
9427+
channel_ready, announcement_sigs, tx_signatures: None, channel_ready_order,
9428+
committed_outbound_htlc_sources
94319429
};
94329430
}
94339431

@@ -9456,9 +9454,9 @@ where
94569454
if commitment_update.is_some() { "a" } else { "no" }, if raa.is_some() { "an" } else { "no" },
94579455
match commitment_order { RAACommitmentOrder::CommitmentFirst => "commitment", RAACommitmentOrder::RevokeAndACKFirst => "RAA"});
94589456
MonitorRestoreUpdates {
9459-
raa, commitment_update, commitment_order, accepted_htlcs: Vec::new(), failed_htlcs, finalized_claimed_htlcs,
9460-
pending_update_adds, funding_broadcastable, channel_ready, announcement_sigs, tx_signatures: None,
9461-
channel_ready_order, committed_outbound_htlc_sources
9457+
raa, commitment_update, commitment_order, failed_htlcs, finalized_claimed_htlcs,
9458+
pending_update_adds, funding_broadcastable, channel_ready, announcement_sigs,
9459+
tx_signatures: None, channel_ready_order, committed_outbound_htlc_sources
94629460
}
94639461
}
94649462

lightning/src/ln/channelmanager.rs

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3332,13 +3332,12 @@ macro_rules! handle_monitor_update_completion {
33323332
None
33333333
};
33343334

3335-
let (htlc_forwards, decode_update_add_htlcs) = $self.handle_channel_resumption(
3335+
let decode_update_add_htlcs = $self.handle_channel_resumption(
33363336
&mut $peer_state.pending_msg_events,
33373337
$chan,
33383338
updates.raa,
33393339
updates.commitment_update,
33403340
updates.commitment_order,
3341-
updates.accepted_htlcs,
33423341
updates.pending_update_adds,
33433342
updates.funding_broadcastable,
33443343
updates.channel_ready,
@@ -3361,7 +3360,6 @@ macro_rules! handle_monitor_update_completion {
33613360
cp_node_id,
33623361
unbroadcasted_batch_funding_txid,
33633362
update_actions,
3364-
htlc_forwards,
33653363
decode_update_add_htlcs,
33663364
updates.finalized_claimed_htlcs,
33673365
updates.failed_htlcs,
@@ -9555,7 +9553,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
95559553
&self, channel_id: ChannelId, counterparty_node_id: PublicKey,
95569554
unbroadcasted_batch_funding_txid: Option<Txid>,
95579555
update_actions: Vec<MonitorUpdateCompletionAction>,
9558-
htlc_forwards: Option<PerSourcePendingForward>,
95599556
decode_update_add_htlcs: Option<(u64, Vec<msgs::UpdateAddHTLC>)>,
95609557
finalized_claimed_htlcs: Vec<(HTLCSource, Option<AttributionData>)>,
95619558
failed_htlcs: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
@@ -9611,9 +9608,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
96119608

96129609
self.handle_monitor_update_completion_actions(update_actions);
96139610

9614-
if let Some(forwards) = htlc_forwards {
9615-
self.forward_htlcs(&mut [forwards][..]);
9616-
}
96179611
if let Some(decode) = decode_update_add_htlcs {
96189612
self.push_decode_update_add_htlcs(decode);
96199613
}
@@ -9826,17 +9820,16 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
98269820
fn handle_channel_resumption(&self, pending_msg_events: &mut Vec<MessageSendEvent>,
98279821
channel: &mut FundedChannel<SP>, raa: Option<msgs::RevokeAndACK>,
98289822
commitment_update: Option<msgs::CommitmentUpdate>, commitment_order: RAACommitmentOrder,
9829-
pending_forwards: Vec<(PendingHTLCInfo, u64)>, pending_update_adds: Vec<msgs::UpdateAddHTLC>,
9830-
funding_broadcastable: Option<Transaction>,
9823+
pending_update_adds: Vec<msgs::UpdateAddHTLC>, funding_broadcastable: Option<Transaction>,
98319824
channel_ready: Option<msgs::ChannelReady>, announcement_sigs: Option<msgs::AnnouncementSignatures>,
98329825
tx_signatures: Option<msgs::TxSignatures>, tx_abort: Option<msgs::TxAbort>,
98339826
channel_ready_order: ChannelReadyOrder,
9834-
) -> (Option<(u64, PublicKey, OutPoint, ChannelId, u128, Vec<(PendingHTLCInfo, u64)>)>, Option<(u64, Vec<msgs::UpdateAddHTLC>)>) {
9827+
) -> Option<(u64, Vec<msgs::UpdateAddHTLC>)> {
98359828
let logger = WithChannelContext::from(&self.logger, &channel.context, None);
9836-
log_trace!(logger, "Handling channel resumption with {} RAA, {} commitment update, {} pending forwards, {} pending update_add_htlcs, {}broadcasting funding, {} channel ready, {} announcement, {} tx_signatures, {} tx_abort",
9829+
log_trace!(logger, "Handling channel resumption with {} RAA, {} commitment update, {} pending update_add_htlcs, {}broadcasting funding, {} channel ready, {} announcement, {} tx_signatures, {} tx_abort",
98379830
if raa.is_some() { "an" } else { "no" },
98389831
if commitment_update.is_some() { "a" } else { "no" },
9839-
pending_forwards.len(), pending_update_adds.len(),
9832+
pending_update_adds.len(),
98409833
if funding_broadcastable.is_some() { "" } else { "not " },
98419834
if channel_ready.is_some() { "sending" } else { "without" },
98429835
if announcement_sigs.is_some() { "sending" } else { "without" },
@@ -9847,14 +9840,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
98479840
let counterparty_node_id = channel.context.get_counterparty_node_id();
98489841
let outbound_scid_alias = channel.context.outbound_scid_alias();
98499842

9850-
let mut htlc_forwards = None;
9851-
if !pending_forwards.is_empty() {
9852-
htlc_forwards = Some((
9853-
outbound_scid_alias, channel.context.get_counterparty_node_id(),
9854-
channel.funding.get_funding_txo().unwrap(), channel.context.channel_id(),
9855-
channel.context.get_user_id(), pending_forwards
9856-
));
9857-
}
98589843
let mut decode_update_add_htlcs = None;
98599844
if !pending_update_adds.is_empty() {
98609845
decode_update_add_htlcs = Some((outbound_scid_alias, pending_update_adds));
@@ -9942,7 +9927,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
99429927
},
99439928
None => {
99449929
debug_assert!(false, "Channel resumed without a funding txo, this should never happen!");
9945-
return (htlc_forwards, decode_update_add_htlcs);
9930+
return decode_update_add_htlcs;
99469931
}
99479932
};
99489933
} else {
@@ -10030,7 +10015,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1003010015
emit_initial_channel_ready_event!(pending_events, channel);
1003110016
}
1003210017

10033-
(htlc_forwards, decode_update_add_htlcs)
10018+
decode_update_add_htlcs
1003410019
}
1003510020

1003610021
#[rustfmt::skip]
@@ -12114,12 +12099,11 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1211412099
}
1211512100
}
1211612101
let need_lnd_workaround = chan.context.workaround_lnd_bug_4006.take();
12117-
let (htlc_forwards, decode_update_add_htlcs) = self.handle_channel_resumption(
12102+
let decode_update_add_htlcs = self.handle_channel_resumption(
1211812103
&mut peer_state.pending_msg_events, chan, responses.raa, responses.commitment_update, responses.commitment_order,
12119-
Vec::new(), Vec::new(), None, responses.channel_ready, responses.announcement_sigs,
12104+
Vec::new(), None, responses.channel_ready, responses.announcement_sigs,
1212012105
responses.tx_signatures, responses.tx_abort, responses.channel_ready_order,
1212112106
);
12122-
debug_assert!(htlc_forwards.is_none());
1212312107
debug_assert!(decode_update_add_htlcs.is_none());
1212412108
if let Some(upd) = channel_update {
1212512109
peer_state.pending_msg_events.push(upd);

0 commit comments

Comments
 (0)