Merge branch 'master' of github.com:tomochain/tomochain

This commit is contained in:
Nguyen Sy Thanh Son 2019-01-09 03:40:22 +00:00
commit 64cffc42cd
2 changed files with 6 additions and 7 deletions

View file

@ -947,8 +947,7 @@ func (c *Posv) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan
if limit := uint64(2); number < limit || seen > number-limit { if limit := uint64(2); number < limit || seen > number-limit {
// Only take into account the non-epoch blocks // Only take into account the non-epoch blocks
if number%c.config.Epoch != 0 { if number%c.config.Epoch != 0 {
log.Info("len(masternodes)", len(masternodes), "number", number, "limit", limit, "seen", seen, "recent", recent.String(), "snap.Recents", snap.Recents) log.Info("Signed recently, must wait for others ", "len(masternodes)", len(masternodes), "number", number, "limit", limit, "seen", seen, "recent", recent.String(), "snap.Recents", snap.Recents)
log.Info("Signed recently, must wait for others")
<-stop <-stop
return nil, nil return nil, nil
} }

View file

@ -612,12 +612,12 @@ func (self *worker) commitNewWork() {
delete(self.possibleUncles, hash) delete(self.possibleUncles, hash)
} }
} }
if atomic.LoadInt32(&self.mining) == 1 {
// Create the new block to seal with the consensus engine // Create the new block to seal with the consensus engine
if work.Block, err = self.engine.Finalize(self.chain, header, work.state, work.txs, uncles, work.receipts); err != nil { if work.Block, err = self.engine.Finalize(self.chain, header, work.state, work.txs, uncles, work.receipts); err != nil {
log.Error("Failed to finalize block for sealing", "err", err) log.Error("Failed to finalize block for sealing", "err", err)
return return
} }
if atomic.LoadInt32(&self.mining) == 1 {
log.Info("Committing new block", "number", work.Block.Number(), "txs", work.tcount, "special txs", len(specialTxs), "uncles", len(uncles), "elapsed", common.PrettyDuration(time.Since(tstart))) log.Info("Committing new block", "number", work.Block.Number(), "txs", work.tcount, "special txs", len(specialTxs), "uncles", len(uncles), "elapsed", common.PrettyDuration(time.Since(tstart)))
self.unconfirmed.Shift(work.Block.NumberU64() - 1) self.unconfirmed.Shift(work.Block.NumberU64() - 1)
self.lastParentBlockCommit = parent.Hash().Hex() self.lastParentBlockCommit = parent.Hash().Hex()