From 52375979a5309c54631610e5e4b004ae401644c1 Mon Sep 17 00:00:00 2001 From: victor-tucci Date: Thu, 28 Mar 2024 12:19:34 +0530 Subject: [PATCH] block sync issue for checkpoint is fixed --- CMakeLists.txt | 2 +- src/checkpoints/checkpoints.cpp | 13 +++++++++++-- src/cryptonote_core/blockchain.cpp | 8 ++++++++ src/cryptonote_core/master_node_quorum_cop.cpp | 2 +- src/cryptonote_core/master_node_voting.cpp | 6 +++++- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8922f8f6a3a..ad3405e262f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ message(STATUS "CMake version ${CMAKE_VERSION}") set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "macOS deployment target (Apple clang only)") project(beldex - VERSION 5.0.1 + VERSION 5.0.2 LANGUAGES CXX C) set(BELDEX_RELEASE_CODENAME "Bern") diff --git a/src/checkpoints/checkpoints.cpp b/src/checkpoints/checkpoints.cpp index a632c27ef0f..4a3d5d77dd5 100755 --- a/src/checkpoints/checkpoints.cpp +++ b/src/checkpoints/checkpoints.cpp @@ -70,6 +70,8 @@ namespace cryptonote {144650, "35203798750fc11eb1e8ee1dd71cefa8eb59ea1cfe9dea14368c06ca6addaa83"}, {266284, "446fb044ad9f920d2c1607b792b7667b1d9994edc7fcc72f89282983cb7044cc"}, {301187, "a9676c3fbae6ad42434db2d1ebac90c2e75dbbd02a6b2d45c69d123554c7578f"}, + {3126052,"d3c6d7e2b79c3b455861e99eaed7fc9c47677abe665d0e6b27bf9311397e4c9b"}, + }; crypto::hash get_newest_hardcoded_checkpoint(cryptonote::network_type nettype, uint64_t *height) @@ -135,7 +137,14 @@ namespace cryptonote if (get_checkpoint(height, checkpoint)) { crypto::hash const &curr_hash = checkpoint.block_hash; - CHECK_AND_ASSERT_MES(h == curr_hash, false, "Checkpoint at given height already exists, and hash for new checkpoint was different!"); + if(h != curr_hash && height == 3126052){ + checkpoint.type = checkpoint_type::hardcoded; + checkpoint.height = height; + checkpoint.block_hash = h; + r = update_checkpoint(checkpoint); + } + else + CHECK_AND_ASSERT_MES(h == curr_hash, false, "Checkpoint at given height already exists, and hash for new checkpoint was different!"); } else { @@ -204,7 +213,7 @@ namespace cryptonote } } - if (info.checkpoint) + if (info.checkpoint && (info.checkpoint->height != 3126052)) update_checkpoint(*info.checkpoint); } //--------------------------------------------------------------------------- diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 627b1fdabbe..e122470db9f 100755 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -4139,6 +4139,14 @@ bool Blockchain::basic_block_checks(cryptonote::block const &blk, bool alt_block } else { + crypto::hash melHash = crypto::null_hash; + tools::hex_to_type("b1b16f552bd17f246dce78d05df6794496281a9f4935dc44eec74bbfb18a90b9", melHash); + if(blk_hash == melHash) + { + MGINFO_RED("Block with id: " << blk_hash << ", has wrong expected: d3c6d7e2b79c3b455861e99eaed7fc9c47677abe665d0e6b27bf9311397e4c9b"); + return false; + } + crypto::hash top_hash = get_tail_id(); if(blk.prev_id != top_hash) { diff --git a/src/cryptonote_core/master_node_quorum_cop.cpp b/src/cryptonote_core/master_node_quorum_cop.cpp index 9930ae5a042..9ab7da6cd2d 100755 --- a/src/cryptonote_core/master_node_quorum_cop.cpp +++ b/src/cryptonote_core/master_node_quorum_cop.cpp @@ -714,7 +714,7 @@ namespace master_nodes checkpoint.signatures.push_back(quorum_signature(pool_vote.vote.index_in_group, pool_vote.vote.signature)); } - if (update_checkpoint) + if (update_checkpoint && (checkpoint.height != 3126052)) blockchain.update_checkpoint(checkpoint); return true; diff --git a/src/cryptonote_core/master_node_voting.cpp b/src/cryptonote_core/master_node_voting.cpp index 32fabaeff58..a104d36a109 100755 --- a/src/cryptonote_core/master_node_voting.cpp +++ b/src/cryptonote_core/master_node_voting.cpp @@ -344,6 +344,10 @@ namespace master_nodes if (!crypto::check_signature(hash, key, quorum_signature.signature)) { + if (height == 3126052){ + return true; + } + MGINFO("Incorrect signature for vote, failed verification at height: " << height << " for voter: " << key << "\n" << quorum); return false; } @@ -368,7 +372,7 @@ namespace master_nodes return false; } - if (!verify_quorum_signatures(quorum, quorum_type::checkpointing, hf_version, checkpoint.height, checkpoint.block_hash, checkpoint.signatures)) + if ((checkpoint.height != 3126052) && !verify_quorum_signatures(quorum, quorum_type::checkpointing, hf_version, checkpoint.height, checkpoint.block_hash, checkpoint.signatures)) { LOG_PRINT_L1("Checkpoint failed signature validation at block " << checkpoint.height << " " << checkpoint.block_hash); return false;