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.
This commit is contained in:
Luke Parker 2022-12-11 10:26:11 -05:00
parent d5a5704ba4
commit 259e5815c8
No known key found for this signature in database

View file

@ -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::<u64>();
}
Ok(res)
}