From 4b1d5a10537ab48e3457606ba1cf2ae26a1cb2b2 Mon Sep 17 00:00:00 2001 From: brunoerg Date: Wed, 7 Sep 2022 14:50:06 -0300 Subject: test: invalidating an unknown block throws an error --- test/functional/rpc_invalidateblock.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/functional') 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() -- cgit v1.2.3