messagepool: refactor CapGasFee logic to be cleaner
This commit is contained in:
parent
1927b26abf
commit
00aad34194
@ -225,17 +225,11 @@ func CapGasFee(mff dtypes.DefaultMaxFeeFunc, msg *types.Message, sendSpec *api.M
|
||||
}
|
||||
|
||||
gaslimit := types.NewInt(uint64(msg.GasLimit))
|
||||
|
||||
if !maximizeFeeCap {
|
||||
totalFee := types.BigMul(msg.GasFeeCap, gaslimit)
|
||||
|
||||
if totalFee.LessThanEqual(maxFee) {
|
||||
msg.GasPremium = big.Min(msg.GasFeeCap, msg.GasPremium) // cap premium at FeeCap
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if !maximizeFeeCap && totalFee.GreaterThan(maxFee) {
|
||||
msg.GasFeeCap = big.Div(maxFee, gaslimit)
|
||||
}
|
||||
|
||||
msg.GasPremium = big.Min(msg.GasFeeCap, msg.GasPremium) // cap premium at FeeCap
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user