From 69f313436ff96d1cb0a99bb5398e079c90cefd8d Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 8 Aug 2018 18:31:15 -0700 Subject: [PATCH] blockchain: during fastAdd or if block wasn't already valid, mark as valid in index --- blockchain/chain.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/blockchain/chain.go b/blockchain/chain.go index 3528a007..71c1b2ee 100644 --- a/blockchain/chain.go +++ b/blockchain/chain.go @@ -1158,6 +1158,14 @@ func (b *BlockChain) connectBestChain(node *blockNode, block *btcutil.Block, fla return false, err } + // If this is fast add, or this block node isn't yet marked as + // valid, then we'll update its status and flush the state to + // disk again. + if fastAdd || !b.index.NodeStatus(node).KnownValid() { + b.index.SetStatusFlags(node, statusValid) + flushIndexState() + } + return true, nil } if fastAdd {