aboutsummaryrefslogtreecommitdiff
path: root/src/checkpoints
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/checkpoints/checkpoints.cpp (renamed from src/cryptonote_basic/checkpoints.cpp)11
-rw-r--r--src/checkpoints/checkpoints.h (renamed from src/cryptonote_basic/checkpoints.h)7
2 files changed, 13 insertions, 5 deletions
diff --git a/src/cryptonote_basic/checkpoints.cpp b/src/checkpoints/checkpoints.cpp
index 98e509561..bea392db0 100644
--- a/src/cryptonote_basic/checkpoints.cpp
+++ b/src/checkpoints/checkpoints.cpp
@@ -36,6 +36,7 @@ using namespace epee;
#include "common/dns_utils.h"
#include "include_base_utils.h"
+#include "storages/portable_storage_template_helper.h" // epee json include
#include <sstream>
#include <random>
@@ -51,7 +52,7 @@ namespace cryptonote
//---------------------------------------------------------------------------
bool checkpoints::add_checkpoint(uint64_t height, const std::string& hash_str)
{
- crypto::hash h = null_hash;
+ crypto::hash h = crypto::null_hash;
bool r = epee::string_tools::parse_tpod_from_hex_string(hash_str, h);
CHECK_AND_ASSERT_MES(r, false, "Failed to parse checkpoint hash string into binary representation!");
@@ -135,8 +136,14 @@ namespace cryptonote
return true;
}
- bool checkpoints::init_default_checkpoints()
+ bool checkpoints::init_default_checkpoints(bool testnet)
{
+ if (testnet)
+ {
+ // just use the genesis block on testnet
+ ADD_CHECKPOINT(0, "48ca7cd3c8de5b6a4d53d2861fbdaedca141553559f9be9520068053cda8430b");
+ return true;
+ }
ADD_CHECKPOINT(1, "771fbcd656ec1464d3a02ead5e18644030007a0fc664c0a964d30922821a8148");
ADD_CHECKPOINT(10, "c0e3b387e47042f72d8ccdca88071ff96bff1ac7cde09ae113dbb7ad3fe92381");
ADD_CHECKPOINT(100, "ac3e11ca545e57c49fca2b4e8c48c03c23be047c43e471e1394528b1f9f80b2d");
diff --git a/src/cryptonote_basic/checkpoints.h b/src/checkpoints/checkpoints.h
index 3a74d8a69..a643c5790 100644
--- a/src/cryptonote_basic/checkpoints.h
+++ b/src/checkpoints/checkpoints.h
@@ -31,9 +31,9 @@
#pragma once
#include <map>
#include <vector>
-#include "cryptonote_basic_impl.h"
#include "misc_log_ex.h"
-#include "storages/portable_storage_template_helper.h" // epee json include
+#include "crypto/hash.h"
+#include "serialization/keyvalue_serialization.h"
#define ADD_CHECKPOINT(h, hash) CHECK_AND_ASSERT(add_checkpoint(h, hash), false);
#define JSON_HASH_FILE_NAME "checkpoints.json"
@@ -148,10 +148,11 @@ namespace cryptonote
/**
* @brief loads the default main chain checkpoints
+ * @param testnet whether to load testnet checkpoints or mainnet
*
* @return true unless adding a checkpoint fails
*/
- bool init_default_checkpoints();
+ bool init_default_checkpoints(bool testnet);
/**
* @brief load new checkpoints