mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
Merge pull request #294 from dinhln89/gasprice
Fixed gasprice minimum 2500 for get gasprice api.
This commit is contained in:
commit
fcce1d4fc6
2 changed files with 7 additions and 0 deletions
|
|
@ -14,4 +14,5 @@ const (
|
||||||
LimitPenaltyEpoch = 4
|
LimitPenaltyEpoch = 4
|
||||||
BlocksPerYear = uint64(15768000)
|
BlocksPerYear = uint64(15768000)
|
||||||
LimitThresholdNonceInQueue = 10
|
LimitThresholdNonceInQueue = 10
|
||||||
|
MinGasPrice = 2500
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var maxPrice = big.NewInt(500 * params.Shannon)
|
var maxPrice = big.NewInt(500 * params.Shannon)
|
||||||
|
var minPrice = big.NewInt(common.MinGasPrice)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Blocks int
|
Blocks int
|
||||||
|
|
@ -140,6 +141,11 @@ func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) {
|
||||||
price = new(big.Int).Set(maxPrice)
|
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.cacheLock.Lock()
|
||||||
gpo.lastHead = headHash
|
gpo.lastHead = headHash
|
||||||
gpo.lastPrice = price
|
gpo.lastPrice = price
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue