Skip to content

Commit 34abcf6

Browse files
committed
f check all monitor update types
1 parent 8299357 commit 34abcf6

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

lightning/src/ln/channel.rs

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5350,27 +5350,35 @@ where
53505350
if let OutboundHTLCState::LocalAnnounced(_) = htlc.state {
53515351
for update in self.blocked_monitor_updates.iter() {
53525352
for update in update.update.updates.iter() {
5353-
match update {
5354-
ChannelMonitorUpdateStep::LatestCounterpartyCommitmentTXInfo {
5355-
htlc_outputs,
5353+
let have_htlc = match update {
5354+
ChannelMonitorUpdateStep::LatestCounterpartyCommitment {
5355+
htlc_data,
53565356
..
53575357
} => {
5358-
let have_htlc = htlc_outputs.iter().any(|(_, source)| {
5359-
source.as_ref().map(|s| &**s) == Some(&htlc.source)
5360-
});
5361-
debug_assert!(have_htlc);
5362-
if have_htlc {
5363-
dropped_outbound_htlcs.push((
5364-
htlc.source.clone(),
5365-
htlc.payment_hash,
5366-
counterparty_node_id,
5367-
self.channel_id,
5368-
));
5369-
}
5370-
continue 'htlc_iter;
5358+
let dust =
5359+
htlc_data.dust_htlcs.iter().map(|(_, source)| source.as_ref());
5360+
let nondust =
5361+
htlc_data.nondust_htlc_sources.iter().map(|s| Some(s));
5362+
dust.chain(nondust).any(|source| source == Some(&htlc.source))
53715363
},
5372-
_ => {},
5364+
ChannelMonitorUpdateStep::LatestCounterpartyCommitmentTXInfo {
5365+
htlc_outputs,
5366+
..
5367+
} => htlc_outputs.iter().any(|(_, source)| {
5368+
source.as_ref().map(|s| &**s) == Some(&htlc.source)
5369+
}),
5370+
_ => continue,
5371+
};
5372+
debug_assert!(have_htlc);
5373+
if have_htlc {
5374+
dropped_outbound_htlcs.push((
5375+
htlc.source.clone(),
5376+
htlc.payment_hash,
5377+
counterparty_node_id,
5378+
self.channel_id,
5379+
));
53735380
}
5381+
continue 'htlc_iter;
53745382
}
53755383
}
53765384
}

0 commit comments

Comments
 (0)