aboutsummaryrefslogtreecommitdiff
path: root/eth
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
parentea099f5811574d3dae79a31053d21b523d008d75 (diff)
Decrease minimum gas price at apricot upgrade
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go10
-rw-r--r--eth/gasprice/gasprice.go21
2 files changed, 23 insertions, 8 deletions
diff --git a/eth/backend.go b/eth/backend.go
index e26cbb3..9b6f1e4 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -559,3 +559,13 @@ func (s *Ethereum) AcceptedBlock() *types.Block {
}
return s.blockchain.CurrentBlock()
}
+
+// SetGasPrice sets the minimum gas price to [newGasPrice]
+// sets the price on [s], [txPool], and the gas price oracle
+func (s *Ethereum) SetGasPrice(newGasPrice *big.Int) {
+ s.lock.Lock()
+ s.gasPrice = newGasPrice
+ s.lock.Unlock()
+ s.txPool.SetGasPrice(newGasPrice)
+ s.APIBackend.gpo.SetGasPrice(newGasPrice)
+}
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 {