From 6dca6470a4a3748cf33b92f8ec9d73e49e9abc03 Mon Sep 17 00:00:00 2001 From: Fabian Jahr Date: Mon, 19 Feb 2024 17:50:06 +0100 Subject: [PATCH] test: Add test for loadtxoutset when headers are not synced --- test/functional/feature_assumeutxo.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/functional/feature_assumeutxo.py b/test/functional/feature_assumeutxo.py index d313f0ee278583..1227070c9213c4 100755 --- a/test/functional/feature_assumeutxo.py +++ b/test/functional/feature_assumeutxo.py @@ -113,6 +113,13 @@ def expected_error(log_msg="", rpc_details=""): f.write(valid_snapshot_contents[(32 + 8 + offset + len(content)):]) expected_error(log_msg=f"[snapshot] bad snapshot content hash: expected a4bf3407ccb2cc0145c49ebba8fa91199f8a3903daf0883875941497d2493c27, got {wrong_hash}") + def test_headers_not_synced(self, valid_snapshot_path): + self.log.info("Test loading snapshot when headers are not synced") + for node in self.nodes: + assert_raises_rpc_error(-32603, "The base block header (3bb7ce5eba0be48939b7a521ac1ba9316afee2c7bada3a0cca24188e6d7d96c0) must appear in the headers chain. Make sure all headers are syncing, and call this RPC again.", + node.loadtxoutset, + valid_snapshot_path) + def test_invalid_chainstate_scenarios(self): self.log.info("Test different scenarios of invalid snapshot chainstate in datadir") @@ -166,6 +173,8 @@ def run_test(self): for n in self.nodes: n.setmocktime(n.getblockheader(n.getbestblockhash())['time']) + self.test_headers_not_synced(dump_output['path']) + # Generate a series of blocks that `n0` will have in the snapshot, # but that n1 doesn't yet see. In order for the snapshot to activate, # though, we have to ferry over the new headers to n1 so that it