|
|
@ -100,6 +100,10 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block, toContract |
|
|
|
// Get the sender
|
|
|
|
// Get the sender
|
|
|
|
sender := block.state.GetAccount(tx.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
|
|
|
|
// Make sure there's enough in the sender's account. Having insufficient
|
|
|
|
// funds won't invalidate this transaction but simple ignores it.
|
|
|
|
// funds won't invalidate this transaction but simple ignores it.
|
|
|
|
totAmount := new(big.Int).Add(tx.Value, new(big.Int).Mul(TxFee, TxFeeRat)) |
|
|
|
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()) |
|
|
|
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
|
|
|
|
// Get the receiver
|
|
|
|
receiver := block.state.GetAccount(tx.Recipient) |
|
|
|
receiver := block.state.GetAccount(tx.Recipient) |
|
|
|
sender.Nonce += 1 |
|
|
|
sender.Nonce += 1 |
|
|
|