43 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY 44 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "checkpoints" 80 CHECK_AND_ASSERT_MES(r,
false,
"Failed to parse checkpoint hash string into binary representation!");
83 if (m_points.count(
height))
85 CHECK_AND_ASSERT_MES(h == m_points[
height],
false,
"Checkpoint at given height already exists, and hash for new checkpoint was different!");
93 return !m_points.empty() && (
height <= (--m_points.end())->first);
98 auto it = m_points.find(
height);
99 is_a_checkpoint = it != m_points.end();
105 MINFO(
"CHECKPOINT PASSED FOR HEIGHT " <<
height <<
" " << h);
109 MWARNING(
"CHECKPOINT FAILED FOR HEIGHT " <<
height <<
". EXPECTED HASH: " << it->second <<
", FETCHED HASH: " << h);
117 return check_block(
height, h, ignored);
121 bool checkpoints::is_alternative_block_allowed(
uint64_t blockchain_height,
uint64_t block_height)
const 123 if (0 == block_height)
126 auto it = m_points.upper_bound(blockchain_height);
128 if (it == m_points.begin())
132 uint64_t checkpoint_height = it->first;
133 return checkpoint_height < block_height;
138 if (m_points.empty())
140 return m_points.rbegin()->first;
143 const std::map<uint64_t, crypto::hash>& checkpoints::get_points()
const 148 bool checkpoints::check_for_conflicts(
const checkpoints& other)
const 152 if (m_points.count(pt.first))
154 CHECK_AND_ASSERT_MES(pt.second == m_points.at(pt.first),
false,
"Checkpoint at given height already exists, and hash for new checkpoint was different!");
164 ADD_CHECKPOINT(1,
"4536e1e23ff7179a126a7e61cd9e89ded0e258176f2bc879c999caa155f68cc3");
165 ADD_CHECKPOINT(10,
"e5aefcb1d575a788ecfb65bb7be3bdd135eb76ccefb38a60d7800e86d25d408e");
166 ADD_CHECKPOINT(100,
"e3548600cc0e2991af4f36bbf44addd95051748fc09e8cac5f8237fd841132c0");
167 ADD_CHECKPOINT(1000,
"d7ec8a6329948fee02cdc95b13f286bd69fe9540863a80dfff7fe14940756293");
168 ADD_CHECKPOINT(10000,
"95dad4575ba43eb0d4ba9b6081d5d52e6a74fc8fe3391d9628f78ddd3b71c965");
169 ADD_CHECKPOINT(100000,
"a7b51ca66b2525903efbd4a32604a7ad5000df4b9da8bdd9cb3062cb014b0cad");
170 ADD_CHECKPOINT(150000,
"e9b66d3f12f9cedece7d9925721b15f1ec6cb2f6b438b3ddd288237c27ffe20e");
171 ADD_CHECKPOINT(179839,
"f8631f50ef79b840cba9fe3484764d0c7515ff2884e1f5be2f7298a4d08e88ee");
172 ADD_CHECKPOINT(179840,
"74958c1b19505ab49babc91dfd14251146256873ae875ac97c26fb2000490e70");
173 ADD_CHECKPOINT(179841,
"8a793f1aef368e83fa72ac3a236309c06ae7726958120514e0f6d33ff3b24548");
174 ADD_CHECKPOINT(200000,
"9a7853584fbe0d88746d3d7bb6a3efd02ecaa3f0158808fde9f3c8339b3d5d8f");
175 ADD_CHECKPOINT(250000,
"0b4d542eeaf6fbd5ceb196ca5ed44edb6ee0c0f1cdf391ba62710b04e1da9f29");
176 ADD_CHECKPOINT(300000,
"e3d192196c70c259164fec04868d5cf21a57242cccf54ca0ba9fd8eaeddb8d72");
177 ADD_CHECKPOINT(307499,
"c08f9eecdebf4f1f99c4c273368df54422e6861829213ad5d0dbde1cf6f4f08c");
178 ADD_CHECKPOINT(307500,
"a65844a64acf5d0aa421892dee64e3552ef390fd29894b7d6c77d08d6609952e");
179 ADD_CHECKPOINT(307501,
"4a5a86a4c6ecee29c2d41d8f633e82a5b3340e354c55f2767f722fc03b950fae");
180 ADD_CHECKPOINT(310000,
"82dfd6ee74a5ae7526af923f1637b59082ef917d84ad80944edb1debd557bb96");
181 ADD_CHECKPOINT(400000,
"251e07872ce8b05dedafbce2dd27f978e71a46aca7fa3b6cdbd94d6b357b5078");
182 ADD_CHECKPOINT(500000,
"c2f37b178f4e1cf3460bcefd6eaf14eeaf4258ee67b97e6146b171766bd8101d");
183 ADD_CHECKPOINT(600000,
"e8eeceec76ea9718ebf7fac34250403f586d01224b343c6e122baa0799023a4f");
184 ADD_CHECKPOINT(700000,
"09af67f7f5b01219dd18c59a424a7570cadfe3c50408180fcaf12cec205155f7");
185 ADD_CHECKPOINT(800000,
"748bfc3c736ac106a8c731114648b8c11c0c2bc3d6b9ab074bbbfc8cc1914a3f");
186 ADD_CHECKPOINT(900000,
"e0fce3c156932d38d8bde4e21fabbf2a8208e96fb1b0848cc796d7338a70f7de");
187 ADD_CHECKPOINT(1000000,
"26da34bde63cfb6447e0dcc190b00e4db04127e2673d48316e63e64c661ab19c");
188 ADD_CHECKPOINT(1100000,
"d9d9637c9468c3d8a3a552cef38e52effbe79d0f140b0a0551d5c15f61e07a08");
189 ADD_CHECKPOINT(1811310,
"f09bc360b87fd1161e28391528e432e7bde14e5183249c06a9db93a0c624499a");
196 bool checkpoints::load_checkpoints_from_json(
const std::string &json_hashfile_fullpath)
198 boost::system::error_code errcode;
199 if (! (boost::filesystem::exists(json_hashfile_fullpath, errcode)))
205 LOG_PRINT_L1(
"Adding checkpoints from blockchain hashfile");
207 uint64_t prev_max_height = get_max_height();
208 LOG_PRINT_L1(
"Hard-coded max checkpoint height is " << prev_max_height);
212 MERROR(
"Error loading checkpoints from " << json_hashfile_fullpath);
215 for (std::vector<t_hashline>::const_iterator it =
hashes.hashlines.begin(); it !=
hashes.hashlines.end(); )
219 if (
height <= prev_max_height) {
234 std::vector<std::string> records;
237 static const std::vector<std::string> dns_urls = {
238 "checkpoints.electroneumpulse.com",
239 "checkpoints.electroneumpulse.info",
240 "checkpoints.electroneumpulse.net",
241 "checkpoints.electroneumpulse.org" 244 static const std::vector<std::string> testnet_dns_urls = {
245 "testpoints.electroneumpulse.com",
246 "testpoints.electroneumpulse.info",
247 "testpoints.electroneumpulse.net",
248 "testpoints.electroneumpulse.org" 251 static const std::vector<std::string> stagenet_dns_urls = {
252 "stagenetpoints.electroneumpulse.com",
253 "stagenetpoints.electroneumpulse.info",
254 "stagenetpoints.electroneumpulse.net",
255 "stagenetpoints.electroneumpulse.org" 261 for (
const auto& record : records)
263 auto pos = record.find(
":");
264 if (pos != std::string::npos)
271 std::stringstream ss(record.substr(0, pos));
295 result = load_checkpoints_from_json(json_hashfile_fullpath);
298 result &= load_checkpoints_from_dns(nettype);
std::vector< t_hashline > hashlines
the checkpoint lines from the file
#define ADD_CHECKPOINT(h, hash)
#define CHECK_AND_ASSERT_MES(expr, fail_ret_val, message)
#define KV_SERIALIZE(varialble)
struct hash_func hashes[]
Holds cryptonote related classes and helpers.
struct for loading many checkpoints from json
unsigned __int64 uint64_t
std::string hash
the hash for the checkpoint
uint64_t height
the height of the checkpoint
struct for loading a checkpoint from json
bool load_t_from_json_file(t_struct &out, const std::string &json_file)
A container for blockchain checkpoints.
const std::map< uint64_t, crypto::hash > & get_points() const
gets the checkpoints container
#define END_KV_SERIALIZE_MAP()
#define BEGIN_KV_SERIALIZE_MAP()