From 60070fe5c62ee40f873148906e205a3f0bb340b6 Mon Sep 17 00:00:00 2001 From: Christopher Harrison <31964100+chrischarlesharrison@users.noreply.github.com> Date: Sat, 5 Aug 2023 00:08:53 +0100 Subject: [PATCH] internal/ethapi, graphql: correct comments about gas price logic (#27752) --- graphql/graphql.go | 2 +- internal/ethapi/api.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphql/graphql.go b/graphql/graphql.go index aa042862bd..3aadaa46cf 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -277,7 +277,7 @@ func (t *Transaction) GasPrice(ctx context.Context) hexutil.Big { case types.DynamicFeeTxType: if block != nil { if baseFee, _ := block.BaseFeePerGas(ctx); baseFee != nil { - // price = min(tip, gasFeeCap - baseFee) + baseFee + // price = min(gasTipCap + baseFee, gasFeeCap) return (hexutil.Big)(*math.BigMin(new(big.Int).Add(tx.GasTipCap(), baseFee.ToInt()), tx.GasFeeCap())) } } diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 6362c74117..0857679227 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1428,7 +1428,7 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber result.GasTipCap = (*hexutil.Big)(tx.GasTipCap()) // if the transaction has been mined, compute the effective gas price if baseFee != nil && blockHash != (common.Hash{}) { - // price = min(tip, gasFeeCap - baseFee) + baseFee + // price = min(gasTipCap + baseFee, gasFeeCap) price := math.BigMin(new(big.Int).Add(tx.GasTipCap(), baseFee), tx.GasFeeCap()) result.GasPrice = (*hexutil.Big)(price) } else {