diff options
author | MacroFake <falke.marco@gmail.com> | 2022-09-08 16:50:59 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-09-08 16:51:03 +0200 |
commit | 37f53863499ac0e14b4dbfc6e696b9bd6d93b708 (patch) | |
tree | 9aa190e01cbcb7bde47838f10bacfb1c97b0b0bb /test/functional | |
parent | 2557429d2b82fe5ba308b940bcf14c3047634345 (diff) | |
parent | 4b1d5a10537ab48e3457606ba1cf2ae26a1cb2b2 (diff) | |
download | bitcoin-37f53863499ac0e14b4dbfc6e696b9bd6d93b708.tar.xz |
Merge bitcoin/bitcoin#26038: test: invalidating an unknown block throws an error
4b1d5a10537ab48e3457606ba1cf2ae26a1cb2b2 test: invalidating an unknown block throws an error (brunoerg)
Pull request description:
While playing with `invalidateblock`, I unintentionally tried to invalidate an unknown block and it threw an error. Looking at the tests I just realized there is no test coverage for this case. This PR adds it.
Top commit has no ACKs.
Tree-SHA512: 25286ead809b3ad022e759127ef3134b271fbe76cb7b50ec2b0c7e2409da8d1b01dc5e80afe73e4564cc9c9c03487a1fe772aea3456988552d2f9c8fb34c730b
Diffstat (limited to 'test/functional')
-rwxr-xr-x | test/functional/rpc_invalidateblock.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/functional/rpc_invalidateblock.py b/test/functional/rpc_invalidateblock.py index f1c2537ef9..705fa6c736 100755 --- a/test/functional/rpc_invalidateblock.py +++ b/test/functional/rpc_invalidateblock.py @@ -8,6 +8,7 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.address import ADDRESS_BCRT1_UNSPENDABLE_DESCRIPTOR from test_framework.util import ( assert_equal, + assert_raises_rpc_error, ) @@ -83,6 +84,11 @@ class InvalidateTest(BitcoinTestFramework): # Should be back at the tip by now assert_equal(self.nodes[1].getbestblockhash(), blocks[-1]) + self.log.info("Verify that invalidating an unknown block throws an error") + chain_tips = self.nodes[1].getchaintips() + assert_raises_rpc_error(-5, "Block not found", self.nodes[1].invalidateblock, "00" * 32) + assert_equal(chain_tips, self.nodes[1].getchaintips()) + if __name__ == '__main__': InvalidateTest().main() |