core/blockchain: Minor fixes to the reorg reporting

This commit is contained in:
Martin Holst Swende 2017-01-17 12:43:28 +01:00
parent 81d63bdec5
commit 0cb9fa06b1

View file

@ -1142,19 +1142,14 @@ func (self *BlockChain) reorg(oldBlock, newBlock *types.Block) error {
} }
} }
oldLen := len(oldChain) if oldLen := len(oldChain); oldLen > 63 || glog.V(logger.Debug) {
if glog.V(logger.Debug) || oldLen > 63 {
commonHash := commonBlock.Hash()
commonNumber := commonBlock.Number()
newLen := len(newChain) newLen := len(newChain)
newLast := newChain[0] newLast := newChain[0]
newFirst := newChain[newLen-1] newFirst := newChain[newLen-1]
oldLast := oldChain[0] oldLast := oldChain[0]
oldFirst := oldChain[oldLen-1] oldFirst := oldChain[oldLen-1]
glog.Infof("Chain split detected after #%v [%x…]. Reorganising chain (-%v +%v blocks) from #%v-#%v [%x/%x] in favour of #%v-#%v [%x/%x]", glog.Infof("Chain split detected after #%v [%x…]. Reorganising chain (-%v +%v blocks), rejecting #%v-#%v [%x…/%x…] in favour of #%v-#%v [%x…/%x…]",
commonNumber, commonHash[:4], commonBlock.Number(), commonBlock.Hash().Bytes()[:4],
oldLen, newLen, oldLen, newLen,
oldFirst.Number(), oldLast.Number(), oldFirst.Number(), oldLast.Number(),
oldFirst.Hash().Bytes()[:4], oldLast.Hash().Bytes()[:4], oldFirst.Hash().Bytes()[:4], oldLast.Hash().Bytes()[:4],