Override for block hashing for block 202612

Since we need to fix tree_hash, but doing so would invalidate the block
id for block 202612, this fix should check to see if we're trying to get
the block id for 202612 (if its blob hash matches) and return the "old"
block id, for backwards compatibility.
This commit is contained in:
Thomas Winget 2014-09-05 18:06:08 -04:00 committed by fluffypony
parent 1d6372cccf
commit a544603a7b

View File

@ -628,6 +628,16 @@ namespace cryptonote
//--------------------------------------------------------------- //---------------------------------------------------------------
bool get_block_hash(const block& b, crypto::hash& res) bool get_block_hash(const block& b, crypto::hash& res)
{ {
// EXCEPTION FOR BLOCK 202612
const std::string correct_blob_hash_202612 = "3a8a2b3a29b50fc86ff73dd087ea43c6f0d6b8f936c849194d5c84c737903966";
const std::string existing_block_id_202612 = "bbd604d2ba11ba27935e006ed39c9bfdd99b76bf4a50654bc1e1e61217962698";
crypto::hash block_blob_hash = get_blob_hash(block_to_blob(b));
if (string_tools::pod_to_hex(block_blob_hash) == correct_blob_hash_202612)
{
res = string_tools::hex_to_pod(existing_block_id_202612);
return true;
}
return get_object_hash(get_block_hashing_blob(b), res); return get_object_hash(get_block_hashing_blob(b), res);
} }
//--------------------------------------------------------------- //---------------------------------------------------------------