From 2995d6c281b83f5bb055a22093b2b94e64c477d3 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 10 Jun 2014 15:02:41 +0200 Subject: [PATCH] Validate minimum gasPrice and reject if not met --- ethchain/transaction_pool.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ethchain/transaction_pool.go b/ethchain/transaction_pool.go index ba2ffcef5..d4175d973 100644 --- a/ethchain/transaction_pool.go +++ b/ethchain/transaction_pool.go @@ -22,6 +22,7 @@ type TxMsgTy byte const ( TxPre = iota TxPost + minGasPrice = 1000000 ) type TxMsg struct { @@ -172,6 +173,12 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error { 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 // attacks