From 6f69cdd109b1dd692b8dfb15e7c53d2051fbc946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 13 Nov 2017 13:47:27 +0200 Subject: all: switch gas limits from big.Int to uint64 --- miner/worker.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'miner') diff --git a/miner/worker.go b/miner/worker.go index c1f848e32..638f759bf 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -413,7 +413,6 @@ func (self *worker) commitNewWork() { ParentHash: parent.Hash(), Number: num.Add(num, common.Big1), GasLimit: core.CalcGasLimit(parent), - GasUsed: new(big.Int), Extra: self.extra, Time: big.NewInt(tstamp), } @@ -588,7 +587,7 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB func (env *Work) commitTransaction(tx *types.Transaction, bc *core.BlockChain, coinbase common.Address, gp *core.GasPool) (error, []*types.Log) { snap := env.state.Snapshot() - receipt, _, err := core.ApplyTransaction(env.config, bc, &coinbase, gp, env.state, env.header, tx, env.header.GasUsed, vm.Config{}) + receipt, _, err := core.ApplyTransaction(env.config, bc, &coinbase, gp, env.state, env.header, tx, &env.header.GasUsed, vm.Config{}) if err != nil { env.state.RevertToSnapshot(snap) return err, nil -- cgit v1.2.3 From 18a7d313386194be39e733ac3043988690f42464 Mon Sep 17 00:00:00 2001 From: Jim McDonald Date: Mon, 15 Jan 2018 10:57:06 +0000 Subject: miner: avoid unnecessary work (#15883) --- miner/worker.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'miner') diff --git a/miner/worker.go b/miner/worker.go index 638f759bf..1520277e1 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -512,6 +512,11 @@ func (env *Work) commitTransactions(mux *event.TypeMux, txs *types.TransactionsB var coalescedLogs []*types.Log for { + // If we don't have enough gas for any further transactions then we're done + if gp.Gas() < params.TxGas { + log.Trace("Not enough gas for further transactions", "gp", gp) + break + } // Retrieve the next transaction and abort if all done tx := txs.Peek() if tx == nil { -- cgit v1.2.3 From 55599ee95d4151a2502465e0afc7c47bd1acba77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 5 Feb 2018 18:40:32 +0200 Subject: core, trie: intermediate mempool between trie and database (#15857) This commit reduces database I/O by not writing every state trie to disk. --- miner/worker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'miner') diff --git a/miner/worker.go b/miner/worker.go index 1520277e1..15395ae0b 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -309,7 +309,7 @@ func (self *worker) wait() { for _, log := range work.state.Logs() { log.BlockHash = block.Hash() } - stat, err := self.chain.WriteBlockAndState(block, work.receipts, work.state) + stat, err := self.chain.WriteBlockWithState(block, work.receipts, work.state) if err != nil { log.Error("Failed writing block to chain", "err", err) continue -- cgit v1.2.3