Add logs to make it more apparent that No Common Ancestors isn't necessarily bad (#3354)

* Add logs to make it more apparent that No Common Ancestors isn't necessarily a bad thing

* Switch No common ancestor log message to DEBUG
This commit is contained in:
Chris Stewart 2021-06-30 09:58:43 -05:00 committed by GitHub
parent 78e2fceb90
commit 639043227c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -111,8 +111,8 @@ private[blockchain] trait BaseBlockChainCompObject
val tipResult: ConnectTipResult = {
findPrevBlockHeaderIdx(header, blockchain) match {
case None =>
logger.warn(
s"No common ancestor found in the chain with tip=${blockchain.tip.hashBE.hex} to connect to hash=${header.hashBE} prevHash=${header.previousBlockHashBE}")
logger.debug(
s"No common ancestor found in the chain with tip=${blockchain.tip.hashBE.hex} to connect to hash=${header.hashBE.hex} prevHash=${header.previousBlockHashBE.hex}. This may be because we have a competing reorg!")
val err = TipUpdateResult.BadPreviousBlockHash(header)
val failed = ConnectTipResult.BadTip(err)
failed

View File

@ -65,22 +65,20 @@ case class NeutrinoNode(
* @return
*/
override def sync(): Future[Unit] = {
val blockchainsF =
BlockHeaderDAO()(executionContext, chainConfig).getBlockchains()
for {
chainApi <- chainApiFromDb()
header <- chainApi.getBestBlockHeader()
bestFilterHeaderOpt <- chainApi.getBestFilterHeader()
bestFilterOpt <- chainApi.getBestFilter()
blockchains <-
BlockHeaderDAO()(executionContext, chainConfig).getBlockchains()
blockchains <- blockchainsF
// Get all of our cached headers in case of a reorg
cachedHeaders = blockchains.flatMap(_.headers).map(_.hashBE.flip)
_ <- peerMsgSender.sendGetHeadersMessage(cachedHeaders)
tip = blockchains
.map(_.tip)
.head //should be safe since we have genesis header inserted in db
_ <- syncFilters(bestFilterHeaderOpt = bestFilterHeaderOpt,
bestFilterOpt = bestFilterOpt,
bestBlockHeader = tip,
bestBlockHeader = header,
chainApi = chainApi)
} yield {
logger.info(