fix hardcorded error

This commit is contained in:
NikVolf 2016-12-14 13:27:02 +01:00
parent 9ebbb252bd
commit 8ba14c028c
1 changed files with 2 additions and 2 deletions

View File

@ -117,7 +117,7 @@ impl<'a> BlockRule for BlockCoinbaseClaim<'a> {
let mut fees: u64 = 0;
for tx in self.block.transactions.iter().skip(1) {
for (tx_idx, tx) in self.block.transactions.iter().skip(1).enumerate() {
// (1) Total sum of all referenced outputs
let mut incoming: u64 = 0;
for input in tx.raw.inputs.iter() {
@ -135,7 +135,7 @@ impl<'a> BlockRule for BlockCoinbaseClaim<'a> {
// Difference between (1) and (2)
let (difference, overflow) = incoming.overflowing_sub(spends);
if overflow {
return Err(Error::Transaction(2, TransactionError::Overspend))
return Err(Error::Transaction(tx_idx + 1, TransactionError::Overspend))
}
// Adding to total fees (with possible overflow)