Skip to content

Commit

Permalink
test: Add test for loadtxoutset when headers are not synced
Browse files Browse the repository at this point in the history
  • Loading branch information
fjahr committed Feb 26, 2024
1 parent 2bc1ecf commit 6dca647
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/functional/feature_assumeutxo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6dca647

Please sign in to comment.