Update gasestimator.go

This commit is contained in:
Felix Lange 2024-05-07 13:56:55 +02:00 committed by GitHub
parent a976688c1e
commit e41244d7d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -81,7 +81,9 @@ func Estimate(ctx context.Context, call *core.Message, opts *Options, gasCap uin
available.Sub(available, call.Value)
}
if opts.Config.IsCancun(opts.Header.Number, opts.Header.Time) && len(call.BlobHashes) > 0 {
blobBalanceUsage := new(big.Int).SetInt64(int64(len(call.BlobHashes)) * params.BlobTxBlobGasPerBlob)
blobGasPerBlob := new(big.Int).SetInt64(params.BlobTxBlobGasPerBlob)
blobBalanceUsage := new(big.Int).SetInt64(int64(len(call.BlobHashes)))
blobBalanceUsage.Mul(blobBalanceUsage, blobGasPerBlob)
blobBalanceUsage.Mul(blobBalanceUsage, call.BlobGasFeeCap)
if blobBalanceUsage.Cmp(available) >= 0 {
return 0, nil, core.ErrInsufficientFunds