Skip to content

Commit ae042eb

Browse files
TheBlueMattAntoine Riard
authored andcommitted
Clean up claimable_outpoints when pending_claim_requests is cleaned
When claimable_outpoints was introduced in "Move our_claim_txn_waiting_first_conf to pending_claim_requests", removal of elements from it (which are just pointers into pending_claim_requests) was never added.
1 parent 475719d commit ae042eb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lightning/src/ln/channelmonitor.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,8 +2492,13 @@ impl ChannelMonitor {
24922492
for ev in events {
24932493
match ev {
24942494
OnchainEvent::Claim { claim_request } => {
2495-
// We may remove a whole set of claim outpoints here, as these one may have been aggregated in a single tx and claimed so atomically
2496-
self.pending_claim_requests.remove(&claim_request);
2495+
// We may remove a whole set of claim outpoints here, as these one may have
2496+
// been aggregated in a single tx and claimed so atomically
2497+
if let Some(bump_material) = self.pending_claim_requests.remove(&claim_request) {
2498+
for outpoint in bump_material.per_input_material.keys() {
2499+
self.claimable_outpoints.remove(&outpoint);
2500+
}
2501+
}
24972502
},
24982503
OnchainEvent::HTLCUpdate { htlc_update } => {
24992504
log_trace!(self, "HTLC {} failure update has got enough confirmations to be passed upstream", log_bytes!((htlc_update.1).0));

0 commit comments

Comments
 (0)