diff --git a/common/constants.go b/common/constants.go index 2d3bcda972..a0a88f1255 100644 --- a/common/constants.go +++ b/common/constants.go @@ -1,16 +1,17 @@ package common const ( - RewardMasterPercent = 40 - RewardVoterPercent = 50 - RewardFoundationPercent = 10 - HexSignMethod = "e341eaa4" - HexSetSecret = "34d38600" - HexSetOpening = "e11f5ba2" - EpocBlockSecret = 800 - EpocBlockOpening = 850 - EpocBlockRandomize = 900 - MaxMasternodes = 150 - LimitPenaltyEpoch = 4 - BlocksPerYear = uint64(15768000) + RewardMasterPercent = 40 + RewardVoterPercent = 50 + RewardFoundationPercent = 10 + HexSignMethod = "e341eaa4" + HexSetSecret = "34d38600" + HexSetOpening = "e11f5ba2" + EpocBlockSecret = 800 + EpocBlockOpening = 850 + EpocBlockRandomize = 900 + MaxMasternodes = 150 + LimitPenaltyEpoch = 4 + BlocksPerYear = uint64(15768000) + LimitThresholdNonceInQueue = 10 ) diff --git a/core/tx_pool.go b/core/tx_pool.go index b07a924beb..ea281a65df 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -600,6 +600,9 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { if pool.currentState.GetNonce(from) > tx.Nonce() { return ErrNonceTooLow } + if pool.pendingState.GetNonce(from)+common.LimitThresholdNonceInQueue < tx.Nonce() { + return ErrNonceTooHigh + } // Transactor should have enough funds to cover the costs // cost == V + GP * GL if pool.currentState.GetBalance(from).Cmp(tx.Cost()) < 0 {