Skip to content

Commit d63ef73

Browse files
committed
test: Add loadtxoutset test with tip on snapshot block
Also pulls out the guarding assert and calls it explicitly before the test function is called. This is already done before the existing call of the test function so it was not needed there.
1 parent c2f86d4 commit d63ef73

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

test/functional/feature_assumeutxo.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
99
The assumeutxo value generated and used here is committed to in
1010
`CRegTestParams::m_assumeutxo_data` in `src/kernel/chainparams.cpp`.
11-
12-
## Possible test improvements
13-
14-
Interesting starting states could be loading a snapshot when the current chain tip is:
15-
16-
- TODO: The snapshot block
17-
1811
"""
1912
from shutil import rmtree
2013

@@ -195,7 +188,6 @@ def test_invalid_file_path(self):
195188
def test_snapshot_with_less_work(self, dump_output_path):
196189
self.log.info("Test bitcoind should fail when snapshot has less accumulated work than this node.")
197190
node = self.nodes[0]
198-
assert_equal(node.getblockcount(), FINAL_HEIGHT)
199191
with node.assert_debug_log(expected_msgs=["[snapshot] activation failed - work does not exceed active chainstate"]):
200192
assert_raises_rpc_error(-32603, "Unable to load UTXO snapshot", node.loadtxoutset, dump_output_path)
201193

@@ -309,6 +301,11 @@ def run_test(self):
309301
self.log.info(f"Creating a UTXO snapshot at height {SNAPSHOT_BASE_HEIGHT}")
310302
dump_output = n0.dumptxoutset('utxos.dat')
311303

304+
self.log.info("Test loading snapshot when the node tip is on the same block as the snapshot")
305+
assert_equal(n0.getblockcount(), SNAPSHOT_BASE_HEIGHT)
306+
assert_equal(n0.getblockchaininfo()["blocks"], SNAPSHOT_BASE_HEIGHT)
307+
self.test_snapshot_with_less_work(dump_output['path'])
308+
312309
self.log.info("Test loading snapshot when headers are not synced")
313310
self.test_headers_not_synced(dump_output['path'])
314311

0 commit comments

Comments
 (0)