mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Merge bitcoin/bitcoin#26038: test: invalidating an unknown block throws an error
4b1d5a1053
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
This commit is contained in:
commit
37f5386349
1 changed files with 6 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue