Minor improvements and bug fixes

* Fixed VM base bug
This commit is contained in:
obscuren
2014-04-24 00:00:50 +02:00
parent 0651af9dfd
commit 1c85d8c66b
4 changed files with 12 additions and 8 deletions

View File

@@ -100,6 +100,10 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block, toContract
// Get the sender
sender := block.state.GetAccount(tx.Sender())
if sender.Nonce != tx.Nonce {
return fmt.Errorf("[TXPL] Invalid account nonce, state nonce is %d transaction nonce is %d instead", sender.Nonce, tx.Nonce)
}
// Make sure there's enough in the sender's account. Having insufficient
// funds won't invalidate this transaction but simple ignores it.
totAmount := new(big.Int).Add(tx.Value, new(big.Int).Mul(TxFee, TxFeeRat))
@@ -107,10 +111,6 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block, toContract
return fmt.Errorf("[TXPL] Insufficient amount in sender's (%x) account", tx.Sender())
}
if sender.Nonce != tx.Nonce {
return fmt.Errorf("[TXPL] Invalid account nonce, state nonce is %d transaction nonce is %d instead", sender.Nonce, tx.Nonce)
}
// Get the receiver
receiver := block.state.GetAccount(tx.Recipient)
sender.Nonce += 1