aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2014-09-05 18:32:31 -0400
committerfluffypony <ric@spagni.net>2014-09-06 21:56:12 +0200
commit9a16bb9936958c8d4fd8f6527fdcfebc2ca0c56b (patch)
treee1abc1ac91bb69f20bfd109a86bdd82f7c33c914
parenthex_to_pod needs the destination as an arg, as opposed to it returning the pod (diff)
downloadmonero-9a16bb9936958c8d4fd8f6527fdcfebc2ca0c56b.tar.xz
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.
-rw-r--r--src/cryptonote_core/cryptonote_format_utils.cpp14
1 files changed, 13 insertions, 1 deletions
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)