Drop uneccessary indirection in map-updating in 1107ab06c3
authorMatt Corallo <git@bluematt.me>
Fri, 17 Apr 2020 23:31:24 +0000 (19:31 -0400)
committerMatt Corallo <git@bluematt.me>
Sun, 19 Apr 2020 00:47:16 +0000 (20:47 -0400)
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

index 2f08fe291d2e922682c41290f597ab30594c235f..3b8238ddcae3d0b3f79d2cb63dbb4ea96eab10ad 100644 (file)
@@ -713,18 +713,14 @@ impl<ChanSigner: ChannelKeys> OnchainTxHandler<ChanSigner> {
 
                // 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;
+                               }
                        }
                }
        }