diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-08-29 17:21:12 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-08-29 17:40:12 +0800 |
commit | e8f229b82ef99213f8f84b8a71f752b236024494 (patch) | |
tree | 62f4d24ddfcb9fba0573531995739bcfdbf8b143 /miner/worker.go | |
parent | c1c003e4ff36c22d67662ca661fc78cde850d401 (diff) | |
download | dexon-e8f229b82ef99213f8f84b8a71f752b236024494.tar dexon-e8f229b82ef99213f8f84b8a71f752b236024494.tar.gz dexon-e8f229b82ef99213f8f84b8a71f752b236024494.tar.bz2 dexon-e8f229b82ef99213f8f84b8a71f752b236024494.tar.lz dexon-e8f229b82ef99213f8f84b8a71f752b236024494.tar.xz dexon-e8f229b82ef99213f8f84b8a71f752b236024494.tar.zst dexon-e8f229b82ef99213f8f84b8a71f752b236024494.zip |
cmd, core, eth, miner, params: configurable gas floor and ceil
Diffstat (limited to 'miner/worker.go')
-rw-r--r-- | miner/worker.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/miner/worker.go b/miner/worker.go index ca68da6e9..5348cb3f1 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -127,6 +127,9 @@ type worker struct { eth Backend chain *core.BlockChain + gasFloor uint64 + gasCeil uint64 + // Subscriptions mux *event.TypeMux txsCh chan core.NewTxsEvent @@ -171,13 +174,15 @@ type worker struct { resubmitHook func(time.Duration, time.Duration) // Method to call upon updating resubmitting interval. } -func newWorker(config *params.ChainConfig, engine consensus.Engine, eth Backend, mux *event.TypeMux, recommit time.Duration) *worker { +func newWorker(config *params.ChainConfig, engine consensus.Engine, eth Backend, mux *event.TypeMux, recommit time.Duration, gasFloor, gasCeil uint64) *worker { worker := &worker{ config: config, engine: engine, eth: eth, mux: mux, chain: eth.BlockChain(), + gasFloor: gasFloor, + gasCeil: gasCeil, possibleUncles: make(map[common.Hash]*types.Block), unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), miningLogAtDepth), pendingTasks: make(map[common.Hash]*task), @@ -807,7 +812,7 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool) { header := &types.Header{ ParentHash: parent.Hash(), Number: num.Add(num, common.Big1), - GasLimit: core.CalcGasLimit(parent), + GasLimit: core.CalcGasLimit(parent, w.gasFloor, w.gasCeil), Extra: w.extra, Time: big.NewInt(tstamp), } |