mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 09:52:09 +01:00
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:
parent
78e2fceb90
commit
639043227c
@ -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
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user