aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/transaction_pool.go
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-06-10 21:02:41 +0800
committerMaran <maran.hidskes@gmail.com>2014-06-10 21:02:41 +0800
commit2995d6c281b83f5bb055a22093b2b94e64c477d3 (patch)
tree21a050fa5380593f9b40743ec2d1dd17e162f553 /ethchain/transaction_pool.go
parent1b40f69ce5166fbe8a13709caf31f50107fa3bdf (diff)
downloaddexon-2995d6c281b83f5bb055a22093b2b94e64c477d3.tar.gz
dexon-2995d6c281b83f5bb055a22093b2b94e64c477d3.tar.zst
dexon-2995d6c281b83f5bb055a22093b2b94e64c477d3.zip
Validate minimum gasPrice and reject if not met
Diffstat (limited to 'ethchain/transaction_pool.go')
-rw-r--r--ethchain/transaction_pool.go7
1 files changed, 7 insertions, 0 deletions
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