diff --git a/common/constants.go b/common/constants.go index a0a88f1255..0571a8cf11 100644 --- a/common/constants.go +++ b/common/constants.go @@ -14,4 +14,5 @@ const ( LimitPenaltyEpoch = 4 BlocksPerYear = uint64(15768000) LimitThresholdNonceInQueue = 10 + MinGasPrice = 2500 ) diff --git a/eth/gasprice/gasprice.go b/eth/gasprice/gasprice.go index 54325692c6..0fe0f3c513 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