Skip to content

Commit b7ba60f

Browse files
mzumsandefjahr
andcommitted
test: add coverage for -reindex and assumeutxo
Co-authored-by: Fabian Jahr <[email protected]>
1 parent e57f951 commit b7ba60f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

test/functional/feature_assumeutxo.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
1212
## Possible test improvements
1313
14-
- TODO: test what happens with -reindex and -reindex-chainstate before the
15-
snapshot is validated, and make sure it's deleted successfully.
16-
1714
Interesting test cases could be loading an assumeutxo snapshot file with:
1815
1916
- TODO: Valid hash but invalid snapshot file (bad coin height or
@@ -379,6 +376,17 @@ def check_tx_counts(final: bool) -> None:
379376
assert_equal(loaded['coins_loaded'], SNAPSHOT_BASE_HEIGHT)
380377
assert_equal(loaded['base_height'], SNAPSHOT_BASE_HEIGHT)
381378

379+
for reindex_arg in ['-reindex=1', '-reindex-chainstate=1']:
380+
self.log.info(f"Check that restarting with {reindex_arg} will delete the snapshot chainstate")
381+
self.restart_node(2, extra_args=[reindex_arg, *self.extra_args[2]])
382+
assert_equal(1, len(n2.getchainstates()["chainstates"]))
383+
for i in range(1, 300):
384+
block = n0.getblock(n0.getblockhash(i), 0)
385+
n2.submitheader(block)
386+
loaded = n2.loadtxoutset(dump_output['path'])
387+
assert_equal(loaded['coins_loaded'], SNAPSHOT_BASE_HEIGHT)
388+
assert_equal(loaded['base_height'], SNAPSHOT_BASE_HEIGHT)
389+
382390
normal, snapshot = n2.getchainstates()['chainstates']
383391
assert_equal(normal['blocks'], START_HEIGHT)
384392
assert_equal(normal.get('snapshot_blockhash'), None)

0 commit comments

Comments
 (0)