Skip to content

Commit

Permalink
Reset basefee to block basefee in estimateGas and createAccessList
Browse files Browse the repository at this point in the history
  • Loading branch information
jdowning100 committed Nov 27, 2024
1 parent 141ec54 commit 228fe49
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/quaiapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions internal/quaiapi/transaction_args.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 228fe49

Please sign in to comment.