fix hardcorded error
This commit is contained in:
parent
9ebbb252bd
commit
8ba14c028c
|
@ -117,7 +117,7 @@ impl<'a> BlockRule for BlockCoinbaseClaim<'a> {
|
||||||
|
|
||||||
let mut fees: u64 = 0;
|
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
|
// (1) Total sum of all referenced outputs
|
||||||
let mut incoming: u64 = 0;
|
let mut incoming: u64 = 0;
|
||||||
for input in tx.raw.inputs.iter() {
|
for input in tx.raw.inputs.iter() {
|
||||||
|
@ -135,7 +135,7 @@ impl<'a> BlockRule for BlockCoinbaseClaim<'a> {
|
||||||
// Difference between (1) and (2)
|
// Difference between (1) and (2)
|
||||||
let (difference, overflow) = incoming.overflowing_sub(spends);
|
let (difference, overflow) = incoming.overflowing_sub(spends);
|
||||||
if overflow {
|
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)
|
// Adding to total fees (with possible overflow)
|
||||||
|
|
Loading…
Reference in New Issue