From ae042ebedbc96aee5395716726b058047f69bbc6 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 9 Dec 2019 22:51:36 -0500 Subject: [PATCH] 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. --- lightning/src/ln/channelmonitor.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lightning/src/ln/channelmonitor.rs b/lightning/src/ln/channelmonitor.rs index 72f11fe25..4b2e0e65e 100644 --- a/lightning/src/ln/channelmonitor.rs +++ b/lightning/src/ln/channelmonitor.rs @@ -2492,8 +2492,13 @@ impl ChannelMonitor { for ev in events { match ev { OnchainEvent::Claim { claim_request } => { - // 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 - self.pending_claim_requests.remove(&claim_request); + // 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 + if let Some(bump_material) = self.pending_claim_requests.remove(&claim_request) { + for outpoint in bump_material.per_input_material.keys() { + self.claimable_outpoints.remove(&outpoint); + } + } }, OnchainEvent::HTLCUpdate { htlc_update } => { log_trace!(self, "HTLC {} failure update has got enough confirmations to be passed upstream", log_bytes!((htlc_update.1).0)); -- 2.39.5