From e286afd0b07ee6e027a07ad9e097f6d4f5fee09b Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 17 Apr 2020 19:31:24 -0400 Subject: [PATCH] Drop uneccessary indirection in map-updating in 1107ab06c3 1107ab06c33bd360bdee7ee64f4b690e753003f6 added a Vec of future updates to apply during a loop, fixing a borrow checker issue that didn't exist in the merged version of the patch. This simply reverts that small part of the change. --- lightning/src/ln/onchaintx.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lightning/src/ln/onchaintx.rs b/lightning/src/ln/onchaintx.rs index 2f08fe29..3b8238dd 100644 --- a/lightning/src/ln/onchaintx.rs +++ b/lightning/src/ln/onchaintx.rs @@ -713,18 +713,14 @@ impl OnchainTxHandler { // Build, bump and rebroadcast tx accordingly log_trace!(self, "Bumping {} candidates", bump_candidates.len()); - let mut pending_claim_updates = Vec::with_capacity(bump_candidates.len()); for (first_claim_txid, claim_material) in bump_candidates.iter() { if let Some((new_timer, new_feerate, bump_tx)) = self.generate_claim_tx(height, &claim_material, &*fee_estimator) { log_trace!(self, "Broadcast onchain {}", log_tx!(bump_tx)); broadcaster.broadcast_transaction(&bump_tx); - pending_claim_updates.push((*first_claim_txid, new_timer, new_feerate)); - } - } - for updates in pending_claim_updates { - if let Some(claim_material) = self.pending_claim_requests.get_mut(&updates.0) { - claim_material.height_timer = updates.1; - claim_material.feerate_previous = updates.2; + if let Some(claim_material) = self.pending_claim_requests.get_mut(first_claim_txid) { + claim_material.height_timer = new_timer; + claim_material.feerate_previous = new_feerate; + } } } } -- 2.30.2