diff --git a/common/constants.go b/common/constants.go index 89ba5c315f..ef6593cfe4 100644 --- a/common/constants.go +++ b/common/constants.go @@ -1,16 +1,18 @@ 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 + MinGasPrice = 2500 ) \ No newline at end of file diff --git a/eth/gasprice/gasprice.go b/eth/gasprice/gasprice.go index 54325692c6..972c6ab3f2 100644 --- a/eth/gasprice/gasprice.go +++ b/eth/gasprice/gasprice.go @@ -30,6 +30,7 @@ import ( ) var maxPrice = big.NewInt(500 * params.Shannon) +var minPrice = big.NewInt(common.MinGasPrice) type Config struct { Blocks int @@ -140,6 +141,11 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) { price = new(big.Int).Set(maxPrice) } + // Check gas price min. + if price.Cmp(minPrice) < 0 { + price = new(big.Int).Set(minPrice) + } + gpo.cacheLock.Lock() gpo.lastHead = headHash gpo.lastPrice = price @@ -186,4 +192,4 @@ type bigIntArray []*big.Int func (s bigIntArray) Len() int { return len(s) } func (s bigIntArray) Less(i, j int) bool { return s[i].Cmp(s[j]) < 0 } -func (s bigIntArray) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s bigIntArray) Swap(i, j int) { s[i], s[j] = s[j], s[i] } \ No newline at end of file