From c2a494c743e6fd32c5f14415d028432b051f8ea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= <peterke@gmail.com> Date: Mon, 29 May 2017 10:21:34 +0300 Subject: eth: update default gas price when not mining too --- eth/api.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'eth/api.go') 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 } -- cgit v1.2.3