fix: potential overflow

This commit is contained in:
gzeon 2025-07-22 00:31:24 +08:00
parent f96f82bd6b
commit bfecb5fbcb
No known key found for this signature in database
GPG key ID: 1C7AA6E2AF68E417

View file

@ -170,7 +170,7 @@ func Estimate(ctx context.Context, call *core.Message, opts *Options, gasCap uin
break break
} }
} }
mid := (hi + lo) / 2 mid := lo + (hi-lo)/2
if mid > lo*2 { if mid > lo*2 {
// Most txs don't need much higher gas limit than their gas used, and most txs don't // Most txs don't need much higher gas limit than their gas used, and most txs don't
// require near the full block limit of gas, so the selection of where to bisect the // require near the full block limit of gas, so the selection of where to bisect the