Skip to content

Commit e876faf

Browse files
committed
policy: integrate policy settings to RPC API
1 parent 37ade79 commit e876faf

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

eth/api_backend.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ import (
2525
"github.com/ethereum/go-ethereum"
2626
"github.com/ethereum/go-ethereum/accounts"
2727
"github.com/ethereum/go-ethereum/common"
28+
cmath "github.com/ethereum/go-ethereum/common/math"
2829
"github.com/ethereum/go-ethereum/consensus"
2930
"github.com/ethereum/go-ethereum/core"
3031
"github.com/ethereum/go-ethereum/core/bloombits"
3132
"github.com/ethereum/go-ethereum/core/rawdb"
3233
"github.com/ethereum/go-ethereum/core/state"
34+
"github.com/ethereum/go-ethereum/core/systemcontracts"
3335
"github.com/ethereum/go-ethereum/core/txpool"
3436
"github.com/ethereum/go-ethereum/core/types"
3537
"github.com/ethereum/go-ethereum/core/vm"
@@ -363,7 +365,16 @@ func (b *EthAPIBackend) SyncProgress() ethereum.SyncProgress {
363365
}
364366

365367
func (b *EthAPIBackend) SuggestGasTipCap(ctx context.Context) (*big.Int, error) {
366-
return b.gpo.SuggestTipCap(ctx)
368+
suggestTipCap, err := b.gpo.SuggestTipCap(ctx)
369+
if err != nil {
370+
return nil, err
371+
}
372+
stateDb, _, err := b.StateAndHeaderByNumber(ctx, rpc.LatestBlockNumber)
373+
if err != nil {
374+
return nil, err
375+
}
376+
minGasTipCap := stateDb.GetState(systemcontracts.PolicyProxyHash, systemcontracts.GetMinGasTipCapStateHash()).Big()
377+
return cmath.BigMax(suggestTipCap, minGasTipCap), nil
367378
}
368379

369380
func (b *EthAPIBackend) FeeHistory(ctx context.Context, blockCount uint64, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (firstBlock *big.Int, reward [][]*big.Int, baseFee []*big.Int, gasUsedRatio []float64, err error) {

0 commit comments

Comments
 (0)