mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-12 11:19:08 -05:00
rpc: call RecalculateBestHeader as part of reconsiderblock
Co-authored-by: Fabian Jahr <fjahr@protonmail.com>
This commit is contained in:
parent
a51e91783a
commit
9275e9689a
2 changed files with 3 additions and 0 deletions
|
@ -1648,6 +1648,7 @@ void ReconsiderBlock(ChainstateManager& chainman, uint256 block_hash) {
|
||||||
}
|
}
|
||||||
|
|
||||||
chainman.ActiveChainstate().ResetBlockFailureFlags(pblockindex);
|
chainman.ActiveChainstate().ResetBlockFailureFlags(pblockindex);
|
||||||
|
chainman.RecalculateBestHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockValidationState state;
|
BlockValidationState state;
|
||||||
|
|
|
@ -83,6 +83,8 @@ class InvalidateTest(BitcoinTestFramework):
|
||||||
self.nodes[1].reconsiderblock(blocks[-4])
|
self.nodes[1].reconsiderblock(blocks[-4])
|
||||||
# Should be back at the tip by now
|
# Should be back at the tip by now
|
||||||
assert_equal(self.nodes[1].getbestblockhash(), blocks[-1])
|
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")
|
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)
|
assert_raises_rpc_error(-5, "Block not found", self.nodes[1].invalidateblock, "00" * 32)
|
||||||
|
|
Loading…
Add table
Reference in a new issue