diff options
author | obscuren <geffobscura@gmail.com> | 2015-06-16 01:28:48 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-06-16 01:28:48 +0800 |
commit | 5daf8729be88eca87b302ebf7a46fc69cad0f6d0 (patch) | |
tree | 0053cb5b84978645b3c83895a651c512e081a183 /miner | |
parent | bac9a94ddf20dc530966cbf6cd384aaf94aedc77 (diff) | |
parent | 4673b04503742de9b1622557b44135d6a4934ad6 (diff) | |
download | go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.tar go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.tar.gz go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.tar.bz2 go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.tar.lz go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.tar.xz go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.tar.zst go-tangerine-5daf8729be88eca87b302ebf7a46fc69cad0f6d0.zip |
Merge branch 'release/0.9.30'v0.9.30
Diffstat (limited to 'miner')
-rw-r--r-- | miner/miner.go | 2 | ||||
-rw-r--r-- | miner/worker.go | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/miner/miner.go b/miner/miner.go index 20ca81648..7f73f3ee8 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -77,7 +77,7 @@ func (m *Miner) SetGasPrice(price *big.Int) { return } - m.worker.gasPrice = price + m.worker.setGasPrice(price) } func (self *Miner) Start(coinbase common.Address, threads int) { diff --git a/miner/worker.go b/miner/worker.go index 611445529..d339507ca 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -6,6 +6,7 @@ import ( "sort" "sync" "sync/atomic" + "time" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" @@ -270,7 +271,6 @@ func (self *worker) wait() { func (self *worker) push() { if atomic.LoadInt32(&self.mining) == 1 { - self.current.block.Header().GasUsed = self.current.totalUsedGas self.current.block.SetRoot(self.current.state.Root()) // push new work to agents @@ -375,6 +375,8 @@ func (self *worker) commitNewWork() { self.currentMu.Lock() defer self.currentMu.Unlock() + tstart := time.Now() + previous := self.current self.makeCurrent() current := self.current @@ -410,7 +412,7 @@ func (self *worker) commitNewWork() { // We only care about logging if we're actually mining if atomic.LoadInt32(&self.mining) == 1 { - glog.V(logger.Info).Infof("commit new work on block %v with %d txs & %d uncles\n", current.block.Number(), current.tcount, len(uncles)) + glog.V(logger.Info).Infof("commit new work on block %v with %d txs & %d uncles. Took %v\n", current.block.Number(), current.tcount, len(uncles), time.Since(tstart)) self.logLocalMinedBlocks(previous) } @@ -438,7 +440,6 @@ func (self *worker) commitUncle(uncle *types.Header) error { // Error not unique return core.UncleError("Uncle not unique") } - self.current.uncles.Add(uncle.Hash()) if !self.current.ancestors.Has(uncle.ParentHash) { return core.UncleError(fmt.Sprintf("Uncle's parent unknown (%x)", uncle.ParentHash[0:4])) @@ -447,6 +448,7 @@ func (self *worker) commitUncle(uncle *types.Header) error { if self.current.family.Has(uncle.Hash()) { return core.UncleError(fmt.Sprintf("Uncle already in family (%x)", uncle.Hash())) } + self.current.uncles.Add(uncle.Hash()) return nil } @@ -510,6 +512,8 @@ func (self *worker) commitTransactions(transactions types.Transactions) { current.tcount++ } } + + self.current.block.Header().GasUsed = self.current.totalUsedGas } func (self *worker) commitTransaction(tx *types.Transaction) error { |