aboutsummaryrefslogtreecommitdiffstats
path: root/eth/api.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-05-29 15:21:34 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-05-29 15:21:34 +0800
commitc2a494c743e6fd32c5f14415d028432b051f8ea1 (patch)
tree417eca52de4c0cdb6a0c76afb54105a4c462d7e4 /eth/api.go
parentcb809c03da18bf45f961a931dfd4c765de144e66 (diff)
downloaddexon-c2a494c743e6fd32c5f14415d028432b051f8ea1.tar
dexon-c2a494c743e6fd32c5f14415d028432b051f8ea1.tar.gz
dexon-c2a494c743e6fd32c5f14415d028432b051f8ea1.tar.bz2
dexon-c2a494c743e6fd32c5f14415d028432b051f8ea1.tar.lz
dexon-c2a494c743e6fd32c5f14415d028432b051f8ea1.tar.xz
dexon-c2a494c743e6fd32c5f14415d028432b051f8ea1.tar.zst
dexon-c2a494c743e6fd32c5f14415d028432b051f8ea1.zip
eth: update default gas price when not mining too
Diffstat (limited to 'eth/api.go')
-rw-r--r--eth/api.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/eth/api.go b/eth/api.go
index 88b3dbbf9..81570988c 100644
--- a/eth/api.go
+++ b/eth/api.go
@@ -154,7 +154,11 @@ func (api *PrivateMinerAPI) Start(threads *int) error {
// Start the miner and return
if !api.e.IsMining() {
// Propagate the initial price point to the transaction pool
- api.e.txPool.SetGasPrice(api.e.gasPrice)
+ api.e.lock.RLock()
+ price := api.e.gasPrice
+ api.e.lock.RUnlock()
+
+ api.e.txPool.SetGasPrice(price)
return api.e.StartMining(true)
}
return nil
@@ -182,6 +186,10 @@ func (api *PrivateMinerAPI) SetExtra(extra string) (bool, error) {
// SetGasPrice sets the minimum accepted gas price for the miner.
func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool {
+ api.e.lock.Lock()
+ api.e.gasPrice = (*big.Int)(&gasPrice)
+ api.e.lock.Unlock()
+
api.e.txPool.SetGasPrice((*big.Int)(&gasPrice))
return true
}