Fixed gasprice minimum 2500 for get gasprice api.

This commit is contained in:
MestryOmkar 2018-11-12 16:09:28 +05:30
parent bbadba469b
commit d3fc7da872
2 changed files with 21 additions and 13 deletions

View file

@ -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
)

View file

@ -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] }