Skip to content

Commit

Permalink
bc import: change sleeptime , cryptonote core: initialize testnet che…
Browse files Browse the repository at this point in the history
…ckpoints
  • Loading branch information
hayzamjs committed Sep 6, 2023
1 parent ac96da9 commit 6730018
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/blockchain_utilities/blockchain_import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,11 @@ int main(int argc, char *argv[]) {
<< ".\n"
"*********************************************************"
"********************************\n"
"You have 90 seconds to press ^C or terminate this "
"You have 10 seconds to press ^C or terminate this "
"program before unverified import starts\n"
"*********************************************************"
"********************************");
sleep(90);
sleep(10);
}

cryptonote::cryptonote_protocol_stub
Expand Down
1 change: 0 additions & 1 deletion src/checkpoints/checkpoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ bool checkpoints::init_default_checkpoints(network_type nettype) {
9000,
"dfda0b4ab55db760aac40164f4043e89b3733c31ebae00381b343c085056c57d",
"0x3ceb638a1");

return true;
}

Expand Down
6 changes: 4 additions & 2 deletions src/cryptonote_core/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,10 +1000,12 @@ std::pair<bool, uint64_t> Blockchain::check_difficulty_checkpoints() const {
uint64_t res = 0;
for (const std::pair<const uint64_t, difficulty_type> &i :
m_checkpoints.get_difficulty_points()) {
if (i.first >= m_db->height())
if (i.first >= m_db->height()) {
break;
if (m_db->get_block_cumulative_difficulty(i.first) != i.second)
}
if (m_db->get_block_cumulative_difficulty(i.first) != i.second) {
return {false, res};
}
res = i.first;
}
return {true, res};
Expand Down
11 changes: 10 additions & 1 deletion src/cryptonote_core/cryptonote_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,9 @@ bool core::handle_command_line(

auto data_dir = boost::filesystem::path(m_config_folder);

cryptonote::checkpoints checkpoints;

if (m_nettype == MAINNET) {
cryptonote::checkpoints checkpoints;
if (!checkpoints.init_default_checkpoints(m_nettype)) {
throw std::runtime_error("Failed to initialize checkpoints");
}
Expand All @@ -338,6 +339,14 @@ bool core::handle_command_line(
set_checkpoints_file_path(checkpoint_json_hashfile_fullpath.string());
}

if (m_nettype == TESTNET) {
if (!checkpoints.init_default_checkpoints(m_nettype)) {
throw std::runtime_error("Failed to initialize checkpoints");
}

set_checkpoints(std::move(checkpoints));
}

set_enforce_dns_checkpoints(command_line::get_arg(vm, arg_dns_checkpoints));
test_drop_download_height(
command_line::get_arg(vm, arg_test_drop_download_height));
Expand Down

0 comments on commit 6730018

Please sign in to comment.