From 228fe49c28570193b5a3696fac3b54f142c75d1d Mon Sep 17 00:00:00 2001 From: Jonathan Downing Date: Wed, 27 Nov 2024 11:20:48 -0600 Subject: [PATCH] Reset basefee to block basefee in estimateGas and createAccessList --- core/core.go | 2 +- internal/quaiapi/api.go | 6 +++--- internal/quaiapi/transaction_args.go | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/core.go b/core/core.go index 8d98b424d3..6e37cfc5a9 100644 --- a/core/core.go +++ b/core/core.go @@ -1306,7 +1306,7 @@ func (c *Core) GetUTXOsByAddress(address common.Address) ([]*types.UtxoEntry, er for _, outpoint := range outpointsForAddress { entry := rawdb.GetUTXO(c.sl.sliceDb, outpoint.TxHash, outpoint.Index) if entry == nil { - return nil, errors.New("failed to get UTXO for address") + continue } utxos = append(utxos, entry) } diff --git a/internal/quaiapi/api.go b/internal/quaiapi/api.go index 0ed938d425..e015a9200c 100644 --- a/internal/quaiapi/api.go +++ b/internal/quaiapi/api.go @@ -704,14 +704,14 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr hi = uint64(*args.Gas) } else { // Retrieve the block to act as the gas ceiling - block, err := b.BlockByNumberOrHash(ctx, blockNrOrHash) + header, err := b.HeaderByNumberOrHash(ctx, blockNrOrHash) if err != nil { return 0, err } - if block == nil { + if header == nil { return 0, errors.New("block not found") } - hi = block.GasLimit() + hi = header.GasLimit() if hi == 0 { hi = params.GasCeil } diff --git a/internal/quaiapi/transaction_args.go b/internal/quaiapi/transaction_args.go index b2e61a9fed..3651735c85 100644 --- a/internal/quaiapi/transaction_args.go +++ b/internal/quaiapi/transaction_args.go @@ -183,6 +183,9 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int, no if args.AccessList != nil { accessList = *args.AccessList } + if gasPrice.Cmp(baseFee) < 0 { + gasPrice = new(big.Int).Set(baseFee) + } msg := types.NewMessage(addr, args.To, uint64(*args.Nonce), value, gas, gasPrice, minerTip, data, accessList, false) return msg, nil }