core: report 1-block reorgs on the metrics too

This commit is contained in:
Péter Szilágyi 2019-08-22 11:48:24 +03:00 committed by GitHub
parent ee841f6ac4
commit 26b85e9be1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1475,10 +1475,8 @@ func (bc *BlockChain) reorg(oldBlock, newBlock *types.Block) error {
}
logFn(msg, "number", commonBlock.Number(), "hash", commonBlock.Hash(),
"drop", len(oldChain), "dropfrom", oldChain[0].Hash(), "add", len(newChain), "addfrom", newChain[0].Hash())
if len(oldChain) > 1 {
blockReorgAddMeter.Mark(int64(len(newChain)))
blockReorgDropMeter.Mark(int64(len(oldChain)))
}
} else {
log.Error("Impossible reorg, please file an issue", "oldnum", oldBlock.Number(), "oldhash", oldBlock.Hash(), "newnum", newBlock.Number(), "newhash", newBlock.Hash())
}