From 9a16bb9936958c8d4fd8f6527fdcfebc2ca0c56b Mon Sep 17 00:00:00 2001
From: Thomas Winget <tewinget@gmail.com>
Date: Fri, 5 Sep 2014 18:32:31 -0400
Subject: [PATCH] added double-check for 202612 block id

if a new block has the same block id as 202612 but the wrong blobdata,
this will tell the caller that the block id is actually null_hash rather
than the 202612 block id.
---
 src/cryptonote_core/cryptonote_format_utils.cpp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/cryptonote_core/cryptonote_format_utils.cpp b/src/cryptonote_core/cryptonote_format_utils.cpp
index 057d11fba..c6e619bf4 100644
--- a/src/cryptonote_core/cryptonote_format_utils.cpp
+++ b/src/cryptonote_core/cryptonote_format_utils.cpp
@@ -638,7 +638,19 @@ namespace cryptonote
       string_tools::hex_to_pod(existing_block_id_202612, res);
       return true;
     }
-    return get_object_hash(get_block_hashing_blob(b), res);
+    bool hash_result = get_object_hash(get_block_hashing_blob(b), res);
+
+    if (hash_result)
+    {
+      // make sure that we aren't looking at a block with the 202612 block id but not the correct blobdata
+      if (string_tools::pod_to_hex(res) == existing_block_id_202612)
+      {
+        LOG_ERROR("Block with block id for 202612 but incorrect block blob hash found!");
+        res = null_hash;
+        return false;
+      }
+    }
+    return hash_result;
   }
   //---------------------------------------------------------------
   crypto::hash get_block_hash(const block& b)