Slightly better gas estimator math
This commit is contained in:
parent
90baf06011
commit
5bfee9875c
@ -83,14 +83,16 @@ func (a *GasAPI) GasEstimateGasPrice(ctx context.Context, nblocksincl uint64,
|
||||
// todo: account for how full blocks are
|
||||
|
||||
at := gasUsed / 2
|
||||
prev := big.Zero()
|
||||
|
||||
for _, price := range prices {
|
||||
at -= price.used
|
||||
if at > 0 {
|
||||
prev = price.price
|
||||
continue
|
||||
}
|
||||
|
||||
return price.price, nil
|
||||
return types.BigAdd(big.Div(types.BigAdd(price.price, prev), types.NewInt(2)), big.NewInt(1)), nil
|
||||
}
|
||||
|
||||
switch nblocksincl {
|
||||
|
Loading…
Reference in New Issue
Block a user