mirror of
https://github.com/monero-project/monero.git
synced 2024-12-23 12:09:54 +00:00
blockchain: avoid duplicate block hash computation
This commit is contained in:
parent
f75d51abda
commit
07d655e438
1 changed files with 1 additions and 2 deletions
|
@ -3474,11 +3474,10 @@ leave:
|
||||||
#if defined(PER_BLOCK_CHECKPOINT)
|
#if defined(PER_BLOCK_CHECKPOINT)
|
||||||
if (m_db->height() < m_blocks_hash_check.size())
|
if (m_db->height() < m_blocks_hash_check.size())
|
||||||
{
|
{
|
||||||
auto hash = get_block_hash(bl);
|
|
||||||
const auto &expected_hash = m_blocks_hash_check[m_db->height()];
|
const auto &expected_hash = m_blocks_hash_check[m_db->height()];
|
||||||
if (expected_hash != crypto::null_hash)
|
if (expected_hash != crypto::null_hash)
|
||||||
{
|
{
|
||||||
if (memcmp(&hash, &expected_hash, sizeof(hash)) != 0)
|
if (memcmp(&id, &expected_hash, sizeof(hash)) != 0)
|
||||||
{
|
{
|
||||||
MERROR_VER("Block with id is INVALID: " << id << ", expected " << expected_hash);
|
MERROR_VER("Block with id is INVALID: " << id << ", expected " << expected_hash);
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
|
|
Loading…
Reference in a new issue