Commit 2995d6c2 authored by Maran's avatar Maran

Validate minimum gasPrice and reject if not met

parent 1b40f69c
...@@ -22,6 +22,7 @@ type TxMsgTy byte ...@@ -22,6 +22,7 @@ type TxMsgTy byte
const ( const (
TxPre = iota TxPre = iota
TxPost TxPost
minGasPrice = 1000000
) )
type TxMsg struct { type TxMsg struct {
...@@ -172,6 +173,12 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error { ...@@ -172,6 +173,12 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error {
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 tx.IsContract() {
if tx.GasPrice.Cmp(big.NewInt(minGasPrice)) < 0 {
return fmt.Errorf("[TXPL] Gasprice to low, %s given should be at least %d.", tx.GasPrice, minGasPrice)
}
}
// Increment the nonce making each tx valid only once to prevent replay // Increment the nonce making each tx valid only once to prevent replay
// attacks // attacks
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment