diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 7ffd03e71a..4a7af39b15 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1648,6 +1648,7 @@ void ReconsiderBlock(ChainstateManager& chainman, uint256 block_hash) { } chainman.ActiveChainstate().ResetBlockFailureFlags(pblockindex); + chainman.RecalculateBestHeader(); } BlockValidationState state; diff --git a/test/functional/rpc_invalidateblock.py b/test/functional/rpc_invalidateblock.py index db79d55259..c7c7d578bb 100755 --- a/test/functional/rpc_invalidateblock.py +++ b/test/functional/rpc_invalidateblock.py @@ -83,6 +83,8 @@ class InvalidateTest(BitcoinTestFramework): self.nodes[1].reconsiderblock(blocks[-4]) # Should be back at the tip by now assert_equal(self.nodes[1].getbestblockhash(), blocks[-1]) + # Should report consistent blockchain info + assert_equal(self.nodes[1].getblockchaininfo()["headers"], self.nodes[1].getblockchaininfo()["blocks"]) self.log.info("Verify that invalidating an unknown block throws an error") assert_raises_rpc_error(-5, "Block not found", self.nodes[1].invalidateblock, "00" * 32)