Skip to content

Commit b0aefe5

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 ffe3f0e commit b0aefe5

2 files changed

Lines changed: 17 additions & 35 deletions

File tree

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::{
@@ -1124,8 +1124,6 @@ pub(super) struct MonitorRestoreUpdates {
11241124
// A `CommitmentUpdate` to be sent to our channel peer.
11251125
pub commitment_update: Option<msgs::CommitmentUpdate>,
11261126
pub commitment_order: RAACommitmentOrder,
1127-
// TODO: get rid of this
1128-
pub accepted_htlcs: Vec<(PendingHTLCInfo, u64)>,
11291127
pub failed_htlcs: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
11301128
pub finalized_claimed_htlcs: Vec<(HTLCSource, Option<AttributionData>)>,
11311129
// Inbound update_adds that are now irrevocably committed to this channel and are ready for the
@@ -9428,9 +9426,9 @@ where
94289426
self.context.monitor_pending_commitment_signed = false;
94299427
return MonitorRestoreUpdates {
94309428
raa: None, commitment_update: None, commitment_order: RAACommitmentOrder::RevokeAndACKFirst,
9431-
accepted_htlcs: Vec::new(), failed_htlcs, finalized_claimed_htlcs, pending_update_adds,
9432-
funding_broadcastable, channel_ready, announcement_sigs, tx_signatures: None,
9433-
channel_ready_order, committed_outbound_htlc_sources
9429+
failed_htlcs, finalized_claimed_htlcs, pending_update_adds, funding_broadcastable,
9430+
channel_ready, announcement_sigs, tx_signatures: None, channel_ready_order,
9431+
committed_outbound_htlc_sources
94349432
};
94359433
}
94369434

@@ -9459,9 +9457,9 @@ where
94599457
if commitment_update.is_some() { "a" } else { "no" }, if raa.is_some() { "an" } else { "no" },
94609458
match commitment_order { RAACommitmentOrder::CommitmentFirst => "commitment", RAACommitmentOrder::RevokeAndACKFirst => "RAA"});
94619459
MonitorRestoreUpdates {
9462-
raa, commitment_update, commitment_order, accepted_htlcs: Vec::new(), failed_htlcs, finalized_claimed_htlcs,
9463-
pending_update_adds, funding_broadcastable, channel_ready, announcement_sigs, tx_signatures: None,
9464-
channel_ready_order, committed_outbound_htlc_sources
9460+
raa, commitment_update, commitment_order, failed_htlcs, finalized_claimed_htlcs,
9461+
pending_update_adds, funding_broadcastable, channel_ready, announcement_sigs,
9462+
tx_signatures: None, channel_ready_order, committed_outbound_htlc_sources
94659463
}
94669464
}
94679465

lightning/src/ln/channelmanager.rs

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3335,13 +3335,12 @@ macro_rules! handle_monitor_update_completion {
33353335
None
33363336
};
33373337

3338-
let (htlc_forwards, decode_update_add_htlcs) = $self.handle_channel_resumption(
3338+
let decode_update_add_htlcs = $self.handle_channel_resumption(
33393339
&mut $peer_state.pending_msg_events,
33403340
$chan,
33413341
updates.raa,
33423342
updates.commitment_update,
33433343
updates.commitment_order,
3344-
updates.accepted_htlcs,
33453344
updates.pending_update_adds,
33463345
updates.funding_broadcastable,
33473346
updates.channel_ready,
@@ -3364,7 +3363,6 @@ macro_rules! handle_monitor_update_completion {
33643363
cp_node_id,
33653364
unbroadcasted_batch_funding_txid,
33663365
update_actions,
3367-
htlc_forwards,
33683366
decode_update_add_htlcs,
33693367
updates.finalized_claimed_htlcs,
33703368
updates.failed_htlcs,
@@ -9569,7 +9567,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
95699567
&self, channel_id: ChannelId, counterparty_node_id: PublicKey,
95709568
unbroadcasted_batch_funding_txid: Option<Txid>,
95719569
update_actions: Vec<MonitorUpdateCompletionAction>,
9572-
htlc_forwards: Option<PerSourcePendingForward>,
95739570
decode_update_add_htlcs: Option<(u64, Vec<msgs::UpdateAddHTLC>)>,
95749571
finalized_claimed_htlcs: Vec<(HTLCSource, Option<AttributionData>)>,
95759572
failed_htlcs: Vec<(HTLCSource, PaymentHash, HTLCFailReason)>,
@@ -9625,9 +9622,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
96259622

96269623
self.handle_monitor_update_completion_actions(update_actions);
96279624

9628-
if let Some(forwards) = htlc_forwards {
9629-
self.forward_htlcs(&mut [forwards][..]);
9630-
}
96319625
if let Some(decode) = decode_update_add_htlcs {
96329626
self.push_decode_update_add_htlcs(decode);
96339627
}
@@ -9840,17 +9834,16 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
98409834
fn handle_channel_resumption(&self, pending_msg_events: &mut Vec<MessageSendEvent>,
98419835
channel: &mut FundedChannel<SP>, raa: Option<msgs::RevokeAndACK>,
98429836
commitment_update: Option<msgs::CommitmentUpdate>, commitment_order: RAACommitmentOrder,
9843-
pending_forwards: Vec<(PendingHTLCInfo, u64)>, pending_update_adds: Vec<msgs::UpdateAddHTLC>,
9844-
funding_broadcastable: Option<Transaction>,
9837+
pending_update_adds: Vec<msgs::UpdateAddHTLC>, funding_broadcastable: Option<Transaction>,
98459838
channel_ready: Option<msgs::ChannelReady>, announcement_sigs: Option<msgs::AnnouncementSignatures>,
98469839
tx_signatures: Option<msgs::TxSignatures>, tx_abort: Option<msgs::TxAbort>,
98479840
channel_ready_order: ChannelReadyOrder,
9848-
) -> (Option<(u64, PublicKey, OutPoint, ChannelId, u128, Vec<(PendingHTLCInfo, u64)>)>, Option<(u64, Vec<msgs::UpdateAddHTLC>)>) {
9841+
) -> Option<(u64, Vec<msgs::UpdateAddHTLC>)> {
98499842
let logger = WithChannelContext::from(&self.logger, &channel.context, None);
9850-
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",
9843+
log_trace!(logger, "Handling channel resumption with {} RAA, {} commitment update, {} pending update_add_htlcs, {}broadcasting funding, {} channel ready, {} announcement, {} tx_signatures, {} tx_abort",
98519844
if raa.is_some() { "an" } else { "no" },
98529845
if commitment_update.is_some() { "a" } else { "no" },
9853-
pending_forwards.len(), pending_update_adds.len(),
9846+
pending_update_adds.len(),
98549847
if funding_broadcastable.is_some() { "" } else { "not " },
98559848
if channel_ready.is_some() { "sending" } else { "without" },
98569849
if announcement_sigs.is_some() { "sending" } else { "without" },
@@ -9861,14 +9854,6 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
98619854
let counterparty_node_id = channel.context.get_counterparty_node_id();
98629855
let outbound_scid_alias = channel.context.outbound_scid_alias();
98639856

9864-
let mut htlc_forwards = None;
9865-
if !pending_forwards.is_empty() {
9866-
htlc_forwards = Some((
9867-
outbound_scid_alias, channel.context.get_counterparty_node_id(),
9868-
channel.funding.get_funding_txo().unwrap(), channel.context.channel_id(),
9869-
channel.context.get_user_id(), pending_forwards
9870-
));
9871-
}
98729857
let mut decode_update_add_htlcs = None;
98739858
if !pending_update_adds.is_empty() {
98749859
decode_update_add_htlcs = Some((outbound_scid_alias, pending_update_adds));
@@ -9956,7 +9941,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
99569941
},
99579942
None => {
99589943
debug_assert!(false, "Channel resumed without a funding txo, this should never happen!");
9959-
return (htlc_forwards, decode_update_add_htlcs);
9944+
return decode_update_add_htlcs;
99609945
}
99619946
};
99629947
} else {
@@ -10044,7 +10029,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1004410029
emit_initial_channel_ready_event!(pending_events, channel);
1004510030
}
1004610031

10047-
(htlc_forwards, decode_update_add_htlcs)
10032+
decode_update_add_htlcs
1004810033
}
1004910034

1005010035
#[rustfmt::skip]
@@ -12128,12 +12113,11 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1212812113
}
1212912114
}
1213012115
let need_lnd_workaround = chan.context.workaround_lnd_bug_4006.take();
12131-
let (htlc_forwards, decode_update_add_htlcs) = self.handle_channel_resumption(
12116+
let decode_update_add_htlcs = self.handle_channel_resumption(
1213212117
&mut peer_state.pending_msg_events, chan, responses.raa, responses.commitment_update, responses.commitment_order,
12133-
Vec::new(), Vec::new(), None, responses.channel_ready, responses.announcement_sigs,
12118+
Vec::new(), None, responses.channel_ready, responses.announcement_sigs,
1213412119
responses.tx_signatures, responses.tx_abort, responses.channel_ready_order,
1213512120
);
12136-
debug_assert!(htlc_forwards.is_none());
1213712121
debug_assert!(decode_update_add_htlcs.is_none());
1213812122
if let Some(upd) = channel_update {
1213912123
peer_state.pending_msg_events.push(upd);

0 commit comments

Comments
 (0)