aboutsummaryrefslogtreecommitdiff
path: root/eth/gasprice
diff options
context:
space:
mode:
authorAaron Buchwald <[email protected]>2020-12-17 13:58:14 -0500
committerAaron Buchwald <[email protected]>2020-12-17 13:58:14 -0500
commit3960b690bf8c67afe706bb469b0ff2798424a26e (patch)
tree77b60c080f63df21af115406e6b78a7862a68ad9 /eth/gasprice
parentea099f5811574d3dae79a31053d21b523d008d75 (diff)
Decrease minimum gas price at apricot upgrade
Diffstat (limited to 'eth/gasprice')
-rw-r--r--eth/gasprice/gasprice.go21
1 files changed, 13 insertions, 8 deletions
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 {