Skip to content

Commit df6dc2a

Browse files
committed
test: Assumeutxo: snapshots with less work should not be loaded
1 parent 2ec0a28 commit df6dc2a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/functional/feature_assumeutxo.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ def test_invalid_file_path(self):
161161
path = node.datadir_path / node.chain / "invalid" / "path"
162162
assert_raises_rpc_error(-8, "Couldn't open file {} for reading.".format(path), node.loadtxoutset, path)
163163

164+
def test_snapshot_with_less_work(self, dump_output_path):
165+
self.log.info("Test bitcoind should fail when snapshot has less accumulated work than this node.")
166+
node = self.nodes[0]
167+
assert_equal(node.getblockcount(), FINAL_HEIGHT)
168+
with node.assert_debug_log(expected_msgs=["[snapshot] activation failed - work does not exceed active chainstate"]):
169+
assert_raises_rpc_error(-32603, "Unable to load UTXO snapshot", node.loadtxoutset, dump_output_path)
170+
self.restart_node(0, extra_args=self.extra_args[0])
171+
164172
def run_test(self):
165173
"""
166174
Bring up two (disconnected) nodes, mine some new blocks on the first,
@@ -242,6 +250,7 @@ def run_test(self):
242250

243251
assert_equal(n0.getblockchaininfo()["blocks"], FINAL_HEIGHT)
244252

253+
self.test_snapshot_with_less_work(dump_output['path'])
245254
self.test_invalid_mempool_state(dump_output['path'])
246255
self.test_invalid_snapshot_scenarios(dump_output['path'])
247256
self.test_invalid_chainstate_scenarios()

0 commit comments

Comments
 (0)