From: Matt Corallo Date: Tue, 10 Dec 2019 03:51:36 +0000 (-0500) Subject: Clean up claimable_outpoints when pending_claim_requests is cleaned X-Git-Tag: v0.0.12~169^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=ae042ebedbc96aee5395716726b058047f69bbc6;p=rust-lightning 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. --- diff --git a/lightning/src/ln/channelmonitor.rs b/lightning/src/ln/channelmonitor.rs index 72f11fe2..4b2e0e65 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));