Skip to content

Commit 56ea8ed

Browse files
committed
Merge bitcoin/bitcoin#29428: test: Assumeutxo: snapshots with less work should not be loaded
df6dc2a test: Assumeutxo: snapshots with less work should not be loaded (Hernan Marino) Pull request description: This PR adds a test which checks that snapshots with less accumulated work than the node's active chain, should not be loaded and return with an error. Although in a different context of discussion the missing test was detect in a thread in bitcoin/bitcoin#29394 (see bitcoin/bitcoin#29394 (comment)) ACKs for top commit: maflcko: utACK df6dc2a kevkevinpal: utACK [df6dc2a](bitcoin/bitcoin@df6dc2a) achow101: ACK df6dc2a alfonsoromanz: Re ACK df6dc2a. Make is successful and the test passes. Tree-SHA512: 07a394b4b288cc8ad3f66ed4e70dcda468db18113e9442eb7215cf491768432d55efaaa5b79d633094917e05475a30f0c5e4f64f8f2da293ba306891b4485560
2 parents a937458 + df6dc2a commit 56ea8ed

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
@@ -196,6 +196,14 @@ def test_invalid_file_path(self):
196196
path = node.datadir_path / node.chain / "invalid" / "path"
197197
assert_raises_rpc_error(-8, "Couldn't open file {} for reading.".format(path), node.loadtxoutset, path)
198198

199+
def test_snapshot_with_less_work(self, dump_output_path):
200+
self.log.info("Test bitcoind should fail when snapshot has less accumulated work than this node.")
201+
node = self.nodes[0]
202+
assert_equal(node.getblockcount(), FINAL_HEIGHT)
203+
with node.assert_debug_log(expected_msgs=["[snapshot] activation failed - work does not exceed active chainstate"]):
204+
assert_raises_rpc_error(-32603, "Unable to load UTXO snapshot", node.loadtxoutset, dump_output_path)
205+
self.restart_node(0, extra_args=self.extra_args[0])
206+
199207
def run_test(self):
200208
"""
201209
Bring up two (disconnected) nodes, mine some new blocks on the first,
@@ -277,6 +285,7 @@ def run_test(self):
277285

278286
assert_equal(n0.getblockchaininfo()["blocks"], FINAL_HEIGHT)
279287

288+
self.test_snapshot_with_less_work(dump_output['path'])
280289
self.test_invalid_mempool_state(dump_output['path'])
281290
self.test_invalid_snapshot_scenarios(dump_output['path'])
282291
self.test_invalid_chainstate_scenarios()

0 commit comments

Comments
 (0)