mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
test: Add coverage for failing dumptxoutset behavior
In case of a failure to create the dump, the node should not be left in an inconsistent state like deactivated network activity or an invalidated blockchain.
This commit is contained in:
parent
b8d2f58e06
commit
4b5bf335ad
1 changed files with 11 additions and 1 deletions
|
@ -28,7 +28,7 @@ class DumptxoutsetTest(BitcoinTestFramework):
|
|||
|
||||
FILENAME = 'txoutset.dat'
|
||||
out = node.dumptxoutset(FILENAME, "latest")
|
||||
expected_path = node.datadir_path / self.chain / FILENAME
|
||||
expected_path = node.chain_path / FILENAME
|
||||
|
||||
assert expected_path.is_file()
|
||||
|
||||
|
@ -60,6 +60,16 @@ class DumptxoutsetTest(BitcoinTestFramework):
|
|||
assert_raises_rpc_error(
|
||||
-8, 'Invalid snapshot type "bogus" specified. Please specify "rollback" or "latest"', node.dumptxoutset, 'utxos.dat', "bogus")
|
||||
|
||||
self.log.info(f"Test that dumptxoutset failure does not leave the network activity suspended")
|
||||
rev_file = node.blocks_path / "rev00000.dat"
|
||||
bogus_file = node.blocks_path / "bogus.dat"
|
||||
rev_file.rename(bogus_file)
|
||||
assert_raises_rpc_error(
|
||||
-1, 'Could not roll back to requested height.', node.dumptxoutset, 'utxos.dat', rollback=99)
|
||||
assert_equal(node.getnetworkinfo()['networkactive'], True)
|
||||
|
||||
# Cleanup
|
||||
bogus_file.rename(rev_file)
|
||||
|
||||
if __name__ == '__main__':
|
||||
DumptxoutsetTest(__file__).main()
|
||||
|
|
Loading…
Add table
Reference in a new issue