diff --git a/test/functional/feature_assumeutxo.py b/test/functional/feature_assumeutxo.py index 376e35da3b6269..e15896be024f5a 100755 --- a/test/functional/feature_assumeutxo.py +++ b/test/functional/feature_assumeutxo.py @@ -20,7 +20,6 @@ - TODO: An invalid hash - TODO: Valid hash but invalid snapshot file (bad coin height or truncated file or bad other serialization) -- TODO: Valid snapshot file, but referencing an unknown block - TODO: Valid snapshot file, but referencing a snapshot block that turns out to be invalid, or has an invalid parent - TODO: Valid snapshot file and snapshot block, but the block is not on the @@ -80,6 +79,14 @@ def test_invalid_snapshot_scenarios(self, valid_snapshot_path): error_details = f"assumeutxo block hash in snapshot metadata not recognized ({bad_snapshot_block_hash})" assert_raises_rpc_error(-32603, f"Unable to load UTXO snapshot, {error_details}", self.nodes[1].loadtxoutset, bad_snapshot_path) + self.log.info(" - snapshot file refering to a block that is unknown") + # Represents any unknown block hash + bogus_block_hash = "0" * 64 + with open(bad_snapshot_path, 'wb') as f: + f.write(bytes.fromhex(bogus_block_hash)[::-1] + valid_snapshot_contents[32:]) + error_details = f"assumeutxo block hash in snapshot metadata not recognized ({bogus_block_hash})" + assert_raises_rpc_error(-32603, f"Unable to load UTXO snapshot, {error_details}", self.nodes[1].loadtxoutset, bad_snapshot_path) + self.log.info(" - snapshot file with wrong number of coins") valid_num_coins = struct.unpack("