From 172cda19a0a72b77e3832f2e29ed7ff6f8062c44 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Wed, 12 Oct 2022 17:25:56 +0200 Subject: [PATCH] bitcoin: avoid an unnecessary large clone() --- src/bitcoin/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bitcoin/mod.rs b/src/bitcoin/mod.rs index d3b101d7..ff60b615 100644 --- a/src/bitcoin/mod.rs +++ b/src/bitcoin/mod.rs @@ -176,12 +176,12 @@ impl BitcoinInterface for d::BitcoinD { assert!(tx.block_height.is_some()); spent.push((*op, *txid, block_time)) } else if !tx.conflicting_txs.is_empty() { - for txid in tx.conflicting_txs.clone() { - let tx: Option<&d::GetTxRes> = match cache.get(&txid) { + for txid in &tx.conflicting_txs { + let tx: Option<&d::GetTxRes> = match cache.get(txid) { Some(tx) => tx.as_ref(), None => { let tx = self.get_transaction(&txid); - txs_to_cache.push((txid, tx)); + txs_to_cache.push((*txid, tx)); txs_to_cache.last().unwrap().1.as_ref() } }; @@ -190,7 +190,7 @@ impl BitcoinInterface for d::BitcoinD { if block_height > 1 { spent.push(( *op, - txid, + *txid, tx.block_time.expect("Spend is confirmed"), )) }