0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-05 14:06:27 -05:00

test: invalidating an unknown block throws an error

This commit is contained in:
brunoerg 2022-09-07 14:50:06 -03:00
parent 5291933fed
commit 4b1d5a1053

View file

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