rpc: call RecalculateBestHeader as part of reconsiderblock

Co-authored-by: Fabian Jahr <fjahr@protonmail.com>
This commit is contained in:
Martin Zumsande 2024-08-14 16:47:49 -04:00
parent a51e91783a
commit 9275e9689a
2 changed files with 3 additions and 0 deletions

View File

@ -1648,6 +1648,7 @@ void ReconsiderBlock(ChainstateManager& chainman, uint256 block_hash) {
}
chainman.ActiveChainstate().ResetBlockFailureFlags(pblockindex);
chainman.RecalculateBestHeader();
}
BlockValidationState state;

View File

@ -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)