Skip to content

Commit 01aa4c0

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 baa5fe2 commit 01aa4c0

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
@@ -9392,9 +9390,9 @@ where
93929390
self.context.monitor_pending_commitment_signed = false;
93939391
return MonitorRestoreUpdates {
93949392
raa: None, commitment_update: None, commitment_order: RAACommitmentOrder::RevokeAndACKFirst,
9395-
accepted_htlcs: Vec::new(), failed_htlcs, finalized_claimed_htlcs, pending_update_adds,
9396-
funding_broadcastable, channel_ready, announcement_sigs, tx_signatures: None,
9397-
channel_ready_order, committed_outbound_htlc_sources
9393+
failed_htlcs, finalized_claimed_htlcs, pending_update_adds, funding_broadcastable,
9394+
channel_ready, announcement_sigs, tx_signatures: None, channel_ready_order,
9395+
committed_outbound_htlc_sources
93989396
};
93999397
}
94009398

@@ -9423,9 +9421,9 @@ where
94239421
if commitment_update.is_some() { "a" } else { "no" }, if raa.is_some() { "an" } else { "no" },
94249422
match commitment_order { RAACommitmentOrder::CommitmentFirst => "commitment", RAACommitmentOrder::RevokeAndACKFirst => "RAA"});
94259423
MonitorRestoreUpdates {
9426-
raa, commitment_update, commitment_order, accepted_htlcs: Vec::new(), failed_htlcs, finalized_claimed_htlcs,
9427-
pending_update_adds, funding_broadcastable, channel_ready, announcement_sigs, tx_signatures: None,
9428-
channel_ready_order, committed_outbound_htlc_sources
9424+
raa, commitment_update, commitment_order, failed_htlcs, finalized_claimed_htlcs,
9425+
pending_update_adds, funding_broadcastable, channel_ready, announcement_sigs,
9426+
tx_signatures: None, channel_ready_order, committed_outbound_htlc_sources
94299427
}
94309428
}
94319429

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,
@@ -9571,7 +9569,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
95719569
&self, channel_id: ChannelId, counterparty_node_id: PublicKey,
95729570
unbroadcasted_batch_funding_txid: Option<Txid>,
95739571
update_actions: Vec<MonitorUpdateCompletionAction>,
9574-
htlc_forwards: Option<PerSourcePendingForward>,
95759572
decode_update_add_htlcs: Option<(u64, Vec<msgs::UpdateAddHTLC>)>,
95769573
finalized_claimed_htlcs: Vec<(HTLCSource, Option<AttributionData>)>,
95779574
failed_htlcs: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
@@ -9627,9 +9624,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
96279624

96289625
self.handle_monitor_update_completion_actions(update_actions);
96299626

9630-
if let Some(forwards) = htlc_forwards {
9631-
self.forward_htlcs(&mut [forwards][..]);
9632-
}
96339627
if let Some(decode) = decode_update_add_htlcs {
96349628
self.push_decode_update_add_htlcs(decode);
96359629
}
@@ -9830,17 +9824,16 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
98309824
fn handle_channel_resumption(&self, pending_msg_events: &mut Vec<MessageSendEvent>,
98319825
channel: &mut FundedChannel<SP>, raa: Option<msgs::RevokeAndACK>,
98329826
commitment_update: Option<msgs::CommitmentUpdate>, commitment_order: RAACommitmentOrder,
9833-
pending_forwards: Vec<(PendingHTLCInfo, u64)>, pending_update_adds: Vec<msgs::UpdateAddHTLC>,
9834-
funding_broadcastable: Option<Transaction>,
9827+
pending_update_adds: Vec<msgs::UpdateAddHTLC>, funding_broadcastable: Option<Transaction>,
98359828
channel_ready: Option<msgs::ChannelReady>, announcement_sigs: Option<msgs::AnnouncementSignatures>,
98369829
tx_signatures: Option<msgs::TxSignatures>, tx_abort: Option<msgs::TxAbort>,
98379830
channel_ready_order: ChannelReadyOrder,
9838-
) -> (Option<(u64, PublicKey, OutPoint, ChannelId, u128, Vec<(PendingHTLCInfo, u64)>)>, Option<(u64, Vec<msgs::UpdateAddHTLC>)>) {
9831+
) -> Option<(u64, Vec<msgs::UpdateAddHTLC>)> {
98399832
let logger = WithChannelContext::from(&self.logger, &channel.context, None);
9840-
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",
9833+
log_trace!(logger, "Handling channel resumption with {} RAA, {} commitment update, {} pending update_add_htlcs, {}broadcasting funding, {} channel ready, {} announcement, {} tx_signatures, {} tx_abort",
98419834
if raa.is_some() { "an" } else { "no" },
98429835
if commitment_update.is_some() { "a" } else { "no" },
9843-
pending_forwards.len(), pending_update_adds.len(),
9836+
pending_update_adds.len(),
98449837
if funding_broadcastable.is_some() { "" } else { "not " },
98459838
if channel_ready.is_some() { "sending" } else { "without" },
98469839
if announcement_sigs.is_some() { "sending" } else { "without" },
@@ -9851,14 +9844,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
98519844
let counterparty_node_id = channel.context.get_counterparty_node_id();
98529845
let outbound_scid_alias = channel.context.outbound_scid_alias();
98539846

9854-
let mut htlc_forwards = None;
9855-
if !pending_forwards.is_empty() {
9856-
htlc_forwards = Some((
9857-
outbound_scid_alias, channel.context.get_counterparty_node_id(),
9858-
channel.funding.get_funding_txo().unwrap(), channel.context.channel_id(),
9859-
channel.context.get_user_id(), pending_forwards
9860-
));
9861-
}
98629847
let mut decode_update_add_htlcs = None;
98639848
if !pending_update_adds.is_empty() {
98649849
decode_update_add_htlcs = Some((outbound_scid_alias, pending_update_adds));
@@ -9946,7 +9931,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
99469931
},
99479932
None => {
99489933
debug_assert!(false, "Channel resumed without a funding txo, this should never happen!");
9949-
return (htlc_forwards, decode_update_add_htlcs);
9934+
return decode_update_add_htlcs;
99509935
}
99519936
};
99529937
} else {
@@ -10034,7 +10019,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1003410019
emit_initial_channel_ready_event!(pending_events, channel);
1003510020
}
1003610021

10037-
(htlc_forwards, decode_update_add_htlcs)
10022+
decode_update_add_htlcs
1003810023
}
1003910024

1004010025
#[rustfmt::skip]
@@ -12113,12 +12098,11 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1211312098
}
1211412099
}
1211512100
let need_lnd_workaround = chan.context.workaround_lnd_bug_4006.take();
12116-
let (htlc_forwards, decode_update_add_htlcs) = self.handle_channel_resumption(
12101+
let decode_update_add_htlcs = self.handle_channel_resumption(
1211712102
&mut peer_state.pending_msg_events, chan, responses.raa, responses.commitment_update, responses.commitment_order,
12118-
Vec::new(), Vec::new(), None, responses.channel_ready, responses.announcement_sigs,
12103+
Vec::new(), None, responses.channel_ready, responses.announcement_sigs,
1211912104
responses.tx_signatures, responses.tx_abort, responses.channel_ready_order,
1212012105
);
12121-
debug_assert!(htlc_forwards.is_none());
1212212106
debug_assert!(decode_update_add_htlcs.is_none());
1212312107
if let Some(upd) = channel_update {
1212412108
peer_state.pending_msg_events.push(upd);

0 commit comments

Comments
 (0)