From 259e5815c84fe493cc48c06616e6d7c66da77147 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Sun, 11 Dec 2022 10:26:11 -0500 Subject: [PATCH] Correct global index offsetting Technically, non-0-amount outputs can still appear and this considered them as part of the global 0-amount pool. Now, only outputs which are 0-amount are counted. --- coins/monero/src/wallet/scan.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/coins/monero/src/wallet/scan.rs b/coins/monero/src/wallet/scan.rs index b01a9305..0804e32b 100644 --- a/coins/monero/src/wallet/scan.rs +++ b/coins/monero/src/wallet/scan.rs @@ -377,7 +377,12 @@ impl Scanner { if let Some(timelock) = map(self.scan_transaction(&tx), index) { res.push(timelock); } - index += u64::try_from(tx.prefix.outputs.len()).unwrap(); + index += tx + .prefix + .outputs + .iter() + .filter_map(|output| Some(1).filter(|_| output.amount == 0)) + .sum::(); } Ok(res) }