Merge pull request #5369 from filecoin-project/feat/gas-premium-55
Use 55th percentile instead of median for gas-price
This commit is contained in:
commit
0a85dc6232
@ -93,13 +93,15 @@ type gasMeta struct {
|
|||||||
limit int64
|
limit int64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// finds 55th percntile instead of median to put negative pressure on gas price
|
||||||
func medianGasPremium(prices []gasMeta, blocks int) abi.TokenAmount {
|
func medianGasPremium(prices []gasMeta, blocks int) abi.TokenAmount {
|
||||||
sort.Slice(prices, func(i, j int) bool {
|
sort.Slice(prices, func(i, j int) bool {
|
||||||
// sort desc by price
|
// sort desc by price
|
||||||
return prices[i].price.GreaterThan(prices[j].price)
|
return prices[i].price.GreaterThan(prices[j].price)
|
||||||
})
|
})
|
||||||
|
|
||||||
at := build.BlockGasTarget * int64(blocks) / 2
|
at := build.BlockGasTarget * int64(blocks) / 2 // 50th
|
||||||
|
at += build.BlockGasTarget * int64(blocks) / (2 * 20) // move 5% further
|
||||||
prev1, prev2 := big.Zero(), big.Zero()
|
prev1, prev2 := big.Zero(), big.Zero()
|
||||||
for _, price := range prices {
|
for _, price := range prices {
|
||||||
prev1, prev2 = price.price, prev1
|
prev1, prev2 = price.price, prev1
|
||||||
|
Loading…
Reference in New Issue
Block a user