From 4871fc7441215d7869310fc93c0877a142adb020 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Mon, 12 Dec 2022 08:48:43 -0500 Subject: [PATCH] Update scan.rs --- coins/monero/src/wallet/scan.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coins/monero/src/wallet/scan.rs b/coins/monero/src/wallet/scan.rs index 0804e32b..6500ab85 100644 --- a/coins/monero/src/wallet/scan.rs +++ b/coins/monero/src/wallet/scan.rs @@ -373,7 +373,7 @@ impl Scanner { }; let mut res = vec![]; - for tx in txs { + for (i, tx) in txs.drain(..).enumerate() { if let Some(timelock) = map(self.scan_transaction(&tx), index) { res.push(timelock); } @@ -381,7 +381,9 @@ impl Scanner { .prefix .outputs .iter() - .filter_map(|output| Some(1).filter(|_| output.amount == 0)) + // Filter to miner TX outputs/0-amount outputs since we're tacking the 0-amount index + .filter_map(|output| Some(1).filter(|_| (i == 0) || (output.amount == 0))) + // Since we can't get the length of an iterator, map each value to 1 and sum .sum::(); } Ok(res)