From: Matt Corallo Date: Fri, 17 Apr 2020 23:31:24 +0000 (-0400) Subject: Drop uneccessary indirection in map-updating in 1107ab06c3 X-Git-Tag: v0.0.12~81^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=e286afd0b07ee6e027a07ad9e097f6d4f5fee09b;p=rust-lightning 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. --- diff --git a/lightning/src/ln/onchaintx.rs b/lightning/src/ln/onchaintx.rs index 2f08fe291..3b8238ddc 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; + } } } }