aboutsummaryrefslogtreecommitdiffstats
path: root/eth/api.go
diff options
context:
space:
mode:
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
}