Skip to content

Commit

Permalink
Merge pull request ethereum#271 from nguyenbatam/limit_max_nonce_tran…
Browse files Browse the repository at this point in the history
…saction_in_queue

limit max threshold nonce in queue
  • Loading branch information
ngtuna authored Nov 10, 2018
2 parents b360290 + 2006e32 commit 046ed99
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
25 changes: 13 additions & 12 deletions common/constants.go
Original file line number Diff line number Diff line change
@@ -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
)
3 changes: 3 additions & 0 deletions core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 046ed99

Please sign in to comment.