core: split out TD from database and all internals
This commit is contained in:
@ -283,7 +283,7 @@ func (self *worker) wait() {
|
||||
continue
|
||||
}
|
||||
|
||||
stat, err := self.chain.WriteBlock(block, false)
|
||||
stat, err := self.chain.WriteBlock(block)
|
||||
if err != nil {
|
||||
glog.V(logger.Error).Infoln("error writing block to chain", err)
|
||||
continue
|
||||
@ -533,14 +533,12 @@ func (self *worker) commitNewWork() {
|
||||
|
||||
// create the new block whose nonce will be mined.
|
||||
work.Block = types.NewBlock(header, work.txs, uncles, work.receipts)
|
||||
work.Block.Td = new(big.Int).Set(core.CalcTD(work.Block, self.chain.GetBlock(work.Block.ParentHash())))
|
||||
|
||||
// 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. Took %v\n", work.Block.Number(), work.tcount, len(uncles), time.Since(tstart))
|
||||
self.logLocalMinedBlocks(work, previous)
|
||||
}
|
||||
|
||||
self.push(work)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user