From 3960b690bf8c67afe706bb469b0ff2798424a26e Mon Sep 17 00:00:00 2001 From: Aaron Buchwald Date: Thu, 17 Dec 2020 13:58:14 -0500 Subject: Decrease minimum gas price at apricot upgrade --- eth/gasprice/gasprice.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'eth/gasprice') diff --git a/eth/gasprice/gasprice.go b/eth/gasprice/gasprice.go index 33810b2..dc62ad6 100644 --- a/eth/gasprice/gasprice.go +++ b/eth/gasprice/gasprice.go @@ -48,12 +48,12 @@ type OracleBackend interface { // Oracle recommends gas prices based on the content of recent // blocks. Suitable for both light and full clients. type Oracle struct { - backend OracleBackend - lastHead common.Hash - lastPrice *big.Int - maxPrice *big.Int - cacheLock sync.RWMutex - fetchLock sync.Mutex + backend OracleBackend + lastHead common.Hash + minGasPrice *big.Int + maxPrice *big.Int + cacheLock sync.RWMutex + fetchLock sync.Mutex checkBlocks int percentile int @@ -83,7 +83,7 @@ func NewOracle(backend OracleBackend, params Config) *Oracle { } return &Oracle{ backend: backend, - lastPrice: params.Default, + minGasPrice: params.Default, maxPrice: maxPrice, checkBlocks: blocks, percentile: percent, @@ -93,7 +93,12 @@ func NewOracle(backend OracleBackend, params Config) *Oracle { // SuggestPrice returns a gasprice so that newly created transaction can // have a very high chance to be included in the following blocks. func (gpo *Oracle) SuggestPrice(ctx context.Context) (*big.Int, error) { - return params.MinGasPrice, nil + return gpo.minGasPrice, nil +} + +// SetGasPrice sets the minimum gas price to [newGasPrice] +func (gpo *Oracle) SetGasPrice(newGasPrice *big.Int) { + gpo.minGasPrice = newGasPrice } type getBlockPricesResult struct { -- cgit v1.2.3