You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
throwstd::ios_base::failure("Invalid UTXO set snapshot magic bytes. Please check if this is indeed a snapshot file or if you are using an outdated snapshot format.");
71
+
}
72
+
73
+
// Read the version
74
+
uint16_t version;
75
+
s >> version;
76
+
if (m_supported_versions.find(version) == m_supported_versions.end()) {
77
+
throwstd::ios_base::failure(strprintf("Version of snapshot %s does not match any of the supported versions.", version));
78
+
}
79
+
80
+
// Read the network magic (pchMessageStart)
81
+
MessageStartChars message;
82
+
s >> message;
83
+
if (!std::equal(message.begin(), message.end(), Params().MessageStart().data())) {
84
+
auto metadata_network = GetNetworkForMagic(message);
throwstd::ios_base::failure(strprintf("The network of the snapshot (%s) does not match the network of this node (%s).", network_string, Params().GetChainTypeString()));
88
+
} else {
89
+
throwstd::ios_base::failure("This snapshot has been created for an unrecognized network. This could be a custom signet, a new testnet or possibly caused by data corruption.");
90
+
}
91
+
}
92
+
93
+
s >> m_base_blockheight;
94
+
s >> m_base_blockhash;
95
+
s >> m_coins_count;
96
+
}
43
97
};
44
98
45
99
//! The file in the snapshot chainstate dir which stores the base blockhash. This is
assert_raises_rpc_error(parsing_error_code, "Unable to parse metadata: Invalid UTXO set snapshot magic bytes. Please check if this is indeed a snapshot file or if you are using an outdated snapshot format.", self.nodes[1].loadtxoutset, bad_snapshot_path)
84
+
85
+
self.log.info(" - snapshot file with unsupported version")
assert_raises_rpc_error(parsing_error_code, f"Unable to parse metadata: Version of snapshot {version} does not match any of the supported versions.", self.nodes[1].loadtxoutset, bad_snapshot_path)
90
+
91
+
self.log.info(" - snapshot file with mismatching network magic")
assert_raises_rpc_error(parsing_error_code, f"Unable to parse metadata: The network of the snapshot ({name}) does not match the network of this node (regtest).", self.nodes[1].loadtxoutset, bad_snapshot_path)
105
+
else:
106
+
assert_raises_rpc_error(parsing_error_code, "Unable to parse metadata: This snapshot has been created for an unrecognized network. This could be a custom signet, a new testnet or possibly caused by data corruption.", self.nodes[1].loadtxoutset, bad_snapshot_path)
107
+
78
108
self.log.info(" - snapshot file referring to a block that is not in the assumeutxo parameters")
error_details=f", assumeutxo block hash in snapshot metadata not recognized (hash: {bad_block_hash}, height: {bogus_height}). The following snapshot heights are available: 110, 299."
86
118
expected_error(rpc_details=error_details)
87
119
88
120
self.log.info(" - snapshot file with wrong number of coins")
expected_error(log_msg=f"bad snapshot - coins left over after deserializing 298 coins"ifoff==-1elsef"bad snapshot format or truncated snapshot after deserializing 299 coins")
96
128
97
-
98
129
self.log.info(" - snapshot file with alternated but parsable UTXO data results in different hash")
0 commit comments