Skip to content

Commit 9275e96

Browse files
mzumsandefjahr
andcommitted
rpc: call RecalculateBestHeader as part of reconsiderblock
Co-authored-by: Fabian Jahr <[email protected]>
1 parent a51e917 commit 9275e96

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/rpc/blockchain.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,7 @@ void ReconsiderBlock(ChainstateManager& chainman, uint256 block_hash) {
16481648
}
16491649

16501650
chainman.ActiveChainstate().ResetBlockFailureFlags(pblockindex);
1651+
chainman.RecalculateBestHeader();
16511652
}
16521653

16531654
BlockValidationState state;

test/functional/rpc_invalidateblock.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ def run_test(self):
8383
self.nodes[1].reconsiderblock(blocks[-4])
8484
# Should be back at the tip by now
8585
assert_equal(self.nodes[1].getbestblockhash(), blocks[-1])
86+
# Should report consistent blockchain info
87+
assert_equal(self.nodes[1].getblockchaininfo()["headers"], self.nodes[1].getblockchaininfo()["blocks"])
8688

8789
self.log.info("Verify that invalidating an unknown block throws an error")
8890
assert_raises_rpc_error(-5, "Block not found", self.nodes[1].invalidateblock, "00" * 32)

0 commit comments

Comments
 (0)