validation: call RecalculateBestHeader in InvalidChainFound

This means that it is being called in two situations:
1.) As part of the invalidateblock rpc
2.) When we receive a block for which we have a valid
header in our block index, but the block turns out to be invalid
This commit is contained in:
Martin Zumsande
2024-08-14 17:28:55 -04:00
parent 9275e9689a
commit 783cb7337f
2 changed files with 3 additions and 1 deletions

View File

@@ -41,6 +41,8 @@ class InvalidateTest(BitcoinTestFramework):
self.nodes[0].invalidateblock(badhash)
assert_equal(self.nodes[0].getblockcount(), 4)
assert_equal(self.nodes[0].getbestblockhash(), besthash_n0)
# Should report consistent blockchain info
assert_equal(self.nodes[0].getblockchaininfo()["headers"], self.nodes[0].getblockchaininfo()["blocks"])
self.log.info("Make sure we won't reorg to a lower work chain:")
self.connect_nodes(1, 2)