diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-12-13 19:58:20 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-03-25 13:43:29 +0000 |
commit | e40eb2ad9d18dd57fb369b2e161a9b0abf6340ca (patch) | |
tree | 51f0bf201a2217a2c7bc2d68eb93c1ef4a15f0d9 /src/cryptonote_basic | |
parent | cryptonote: block parsing + hash calculation speedup (diff) | |
download | monero-e40eb2ad9d18dd57fb369b2e161a9b0abf6340ca.tar.xz |
cryptonote_basic: speedup calculate_block_hash
The block 202612 fix can be left tested at the end, if we
already know we're not in the general case
Diffstat (limited to 'src/cryptonote_basic')
-rw-r--r-- | src/cryptonote_basic/cryptonote_format_utils.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cryptonote_basic/cryptonote_format_utils.cpp b/src/cryptonote_basic/cryptonote_format_utils.cpp index 14500361c..410696cb4 100644 --- a/src/cryptonote_basic/cryptonote_format_utils.cpp +++ b/src/cryptonote_basic/cryptonote_format_utils.cpp @@ -1152,6 +1152,13 @@ namespace cryptonote blob = &bd; } + bool hash_result = get_object_hash(get_block_hashing_blob(b), res); + if (!hash_result) + return false; + + if (get_block_height(b) != 202612) + return true; + // EXCEPTION FOR BLOCK 202612 const std::string correct_blob_hash_202612 = "3a8a2b3a29b50fc86ff73dd087ea43c6f0d6b8f936c849194d5c84c737903966"; const std::string existing_block_id_202612 = "bbd604d2ba11ba27935e006ed39c9bfdd99b76bf4a50654bc1e1e61217962698"; @@ -1162,9 +1169,7 @@ namespace cryptonote string_tools::hex_to_pod(existing_block_id_202612, res); return true; } - 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) |