mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-30 03:03:17 +00:00
reload checkpoints file every ~hr and print if any fail
also some other minor bug squashing and code formatting
This commit is contained in:
parent
0e1449135d
commit
30caebfce3
11 changed files with 174 additions and 73 deletions
|
@ -47,6 +47,7 @@
|
||||||
#include "common/boost_serialization_helper.h"
|
#include "common/boost_serialization_helper.h"
|
||||||
#include "warnings.h"
|
#include "warnings.h"
|
||||||
#include "crypto/hash.h"
|
#include "crypto/hash.h"
|
||||||
|
#include "cryptonote_core/checkpoints_create.h"
|
||||||
//#include "serialization/json_archive.h"
|
//#include "serialization/json_archive.h"
|
||||||
|
|
||||||
using namespace cryptonote;
|
using namespace cryptonote;
|
||||||
|
@ -1773,3 +1774,23 @@ bool blockchain_storage::add_new_block(const block& bl_, block_verification_cont
|
||||||
|
|
||||||
return handle_block_to_main_chain(bl, id, bvc);
|
return handle_block_to_main_chain(bl, id, bvc);
|
||||||
}
|
}
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
void blockchain_storage::update_checkpoints(const std::string& file_path)
|
||||||
|
{
|
||||||
|
// if a path is supplied, updated checkpoints from json.
|
||||||
|
// if not, probably fetch from DNS TXT Records.
|
||||||
|
if (file_path.size() > 0)
|
||||||
|
{
|
||||||
|
cryptonote::load_checkpoints_from_json(m_checkpoints, file_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto& points = m_checkpoints.get_points();
|
||||||
|
|
||||||
|
for (const auto& pt : points)
|
||||||
|
{
|
||||||
|
if (!m_checkpoints.check_block(pt.first, get_block_hash(m_blocks[pt.first].bl)))
|
||||||
|
{
|
||||||
|
LOG_ERROR("Checkpoint failed when adding new checkpoints from json file, this could be very bad.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -180,6 +180,7 @@ namespace cryptonote
|
||||||
void print_blockchain(uint64_t start_index, uint64_t end_index);
|
void print_blockchain(uint64_t start_index, uint64_t end_index);
|
||||||
void print_blockchain_index();
|
void print_blockchain_index();
|
||||||
void print_blockchain_outs(const std::string& file);
|
void print_blockchain_outs(const std::string& file);
|
||||||
|
void update_checkpoints(const std::string& file_path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::unordered_map<crypto::hash, size_t> blocks_by_id_index;
|
typedef std::unordered_map<crypto::hash, size_t> blocks_by_id_index;
|
||||||
|
|
|
@ -98,6 +98,7 @@ namespace cryptonote
|
||||||
uint64_t checkpoint_height = it->first;
|
uint64_t checkpoint_height = it->first;
|
||||||
return checkpoint_height < block_height;
|
return checkpoint_height < block_height;
|
||||||
}
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
uint64_t checkpoints::get_max_height()
|
uint64_t checkpoints::get_max_height()
|
||||||
{
|
{
|
||||||
std::map< uint64_t, crypto::hash >::const_iterator highest =
|
std::map< uint64_t, crypto::hash >::const_iterator highest =
|
||||||
|
@ -106,5 +107,10 @@ namespace cryptonote
|
||||||
boost::bind(&std::map< uint64_t, crypto::hash >::value_type::first, _2 ) ) );
|
boost::bind(&std::map< uint64_t, crypto::hash >::value_type::first, _2 ) ) );
|
||||||
return highest->first;
|
return highest->first;
|
||||||
}
|
}
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
const std::map<uint64_t, crypto::hash>& checkpoints::get_points()
|
||||||
|
{
|
||||||
|
return m_points;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
#include "cryptonote_basic_impl.h"
|
#include "cryptonote_basic_impl.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ namespace cryptonote
|
||||||
bool check_block(uint64_t height, const crypto::hash& h, bool& is_a_checkpoint) const;
|
bool check_block(uint64_t height, const crypto::hash& h, bool& is_a_checkpoint) const;
|
||||||
bool is_alternative_block_allowed(uint64_t blockchain_height, uint64_t block_height) const;
|
bool is_alternative_block_allowed(uint64_t blockchain_height, uint64_t block_height) const;
|
||||||
uint64_t get_max_height();
|
uint64_t get_max_height();
|
||||||
|
const std::map<uint64_t, crypto::hash>& get_points();
|
||||||
private:
|
private:
|
||||||
std::map<uint64_t, crypto::hash> m_points;
|
std::map<uint64_t, crypto::hash> m_points;
|
||||||
};
|
};
|
||||||
|
|
110
src/cryptonote_core/checkpoints_create.cpp
Normal file
110
src/cryptonote_core/checkpoints_create.cpp
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
// Copyright (c) 2014, The Monero Project
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
// permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
// conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
// of conditions and the following disclaimer in the documentation and/or other
|
||||||
|
// materials provided with the distribution.
|
||||||
|
//
|
||||||
|
// 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||||
|
// used to endorse or promote products derived from this software without specific
|
||||||
|
// prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||||
|
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||||
|
|
||||||
|
#include "checkpoints_create.h"
|
||||||
|
#include "storages/portable_storage_template_helper.h" // epee json include
|
||||||
|
|
||||||
|
namespace cryptonote
|
||||||
|
{
|
||||||
|
|
||||||
|
struct t_hashline
|
||||||
|
{
|
||||||
|
uint64_t height;
|
||||||
|
std::string hash;
|
||||||
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
|
KV_SERIALIZE(height)
|
||||||
|
KV_SERIALIZE(hash)
|
||||||
|
END_KV_SERIALIZE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
struct t_hash_json {
|
||||||
|
std::vector<t_hashline> hashlines;
|
||||||
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
|
KV_SERIALIZE(hashlines)
|
||||||
|
END_KV_SERIALIZE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
bool create_checkpoints(cryptonote::checkpoints& checkpoints)
|
||||||
|
{
|
||||||
|
ADD_CHECKPOINT(1, "771fbcd656ec1464d3a02ead5e18644030007a0fc664c0a964d30922821a8148");
|
||||||
|
ADD_CHECKPOINT(10, "c0e3b387e47042f72d8ccdca88071ff96bff1ac7cde09ae113dbb7ad3fe92381");
|
||||||
|
ADD_CHECKPOINT(100, "ac3e11ca545e57c49fca2b4e8c48c03c23be047c43e471e1394528b1f9f80b2d");
|
||||||
|
ADD_CHECKPOINT(1000, "5acfc45acffd2b2e7345caf42fa02308c5793f15ec33946e969e829f40b03876");
|
||||||
|
ADD_CHECKPOINT(10000, "c758b7c81f928be3295d45e230646de8b852ec96a821eac3fea4daf3fcac0ca2");
|
||||||
|
ADD_CHECKPOINT(22231, "7cb10e29d67e1c069e6e11b17d30b809724255fee2f6868dc14cfc6ed44dfb25");
|
||||||
|
ADD_CHECKPOINT(29556, "53c484a8ed91e4da621bb2fa88106dbde426fe90d7ef07b9c1e5127fb6f3a7f6");
|
||||||
|
ADD_CHECKPOINT(50000, "0fe8758ab06a8b9cb35b7328fd4f757af530a5d37759f9d3e421023231f7b31c");
|
||||||
|
ADD_CHECKPOINT(80000, "a62dcd7b536f22e003ebae8726e9e7276f63d594e264b6f0cd7aab27b66e75e3");
|
||||||
|
ADD_CHECKPOINT(202612, "bbd604d2ba11ba27935e006ed39c9bfdd99b76bf4a50654bc1e1e61217962698");
|
||||||
|
ADD_CHECKPOINT(202613, "e2aa337e78df1f98f462b3b1e560c6b914dec47b610698b7b7d1e3e86b6197c2");
|
||||||
|
ADD_CHECKPOINT(202614, "c29e3dc37d8da3e72e506e31a213a58771b24450144305bcba9e70fa4d6ea6fb");
|
||||||
|
ADD_CHECKPOINT(205000, "5d3d7a26e6dc7535e34f03def711daa8c263785f73ec1fadef8a45880fde8063");
|
||||||
|
ADD_CHECKPOINT(220000, "9613f455933c00e3e33ac315cc6b455ee8aa0c567163836858c2d9caff111553");
|
||||||
|
ADD_CHECKPOINT(230300, "bae7a80c46859db355556e3a9204a337ae8f24309926a1312323fdecf1920e61");
|
||||||
|
ADD_CHECKPOINT(230700, "93e631240ceac831da1aebfc5dac8f722c430463024763ebafa888796ceaeedf");
|
||||||
|
ADD_CHECKPOINT(231350, "b5add137199b820e1ea26640e5c3e121fd85faa86a1e39cf7e6cc097bdeb1131");
|
||||||
|
ADD_CHECKPOINT(232150, "955de8e6b6508af2c24f7334f97beeea651d78e9ade3ab18fec3763be3201aa8");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool load_checkpoints_from_json(cryptonote::checkpoints& checkpoints, std::string json_hashfile_fullpath)
|
||||||
|
{
|
||||||
|
boost::system::error_code errcode;
|
||||||
|
if (! (boost::filesystem::exists(json_hashfile_fullpath, errcode)))
|
||||||
|
{
|
||||||
|
LOG_PRINT_L0("Blockchain checkpoints file not found");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_PRINT_L0("Adding checkpoints from blockchain hashfile");
|
||||||
|
|
||||||
|
uint64_t prev_max_height = checkpoints.get_max_height();
|
||||||
|
LOG_PRINT_L0("Hard-coded max checkpoint height is " << prev_max_height);
|
||||||
|
t_hash_json hashes;
|
||||||
|
epee::serialization::load_t_from_json_file(hashes, json_hashfile_fullpath);
|
||||||
|
for (std::vector<t_hashline>::const_iterator it = hashes.hashlines.begin(); it != hashes.hashlines.end(); )
|
||||||
|
{
|
||||||
|
uint64_t height;
|
||||||
|
height = it->height;
|
||||||
|
if (height <= prev_max_height) {
|
||||||
|
LOG_PRINT_L0("ignoring checkpoint height " << height);
|
||||||
|
} else {
|
||||||
|
std::string blockhash = it->hash;
|
||||||
|
LOG_PRINT_L0("Adding checkpoint height " << height << ", hash=" << blockhash);
|
||||||
|
ADD_CHECKPOINT(height, blockhash);
|
||||||
|
}
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace cryptonote
|
|
@ -36,77 +36,11 @@
|
||||||
#define ADD_CHECKPOINT(h, hash) CHECK_AND_ASSERT(checkpoints.add_checkpoint(h, hash), false);
|
#define ADD_CHECKPOINT(h, hash) CHECK_AND_ASSERT(checkpoints.add_checkpoint(h, hash), false);
|
||||||
#define JSON_HASH_FILE_NAME "checkpoints.json"
|
#define JSON_HASH_FILE_NAME "checkpoints.json"
|
||||||
|
|
||||||
struct t_hashline
|
namespace cryptonote
|
||||||
{
|
{
|
||||||
uint64_t height;
|
|
||||||
std::string hash;
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
|
||||||
KV_SERIALIZE(height)
|
|
||||||
KV_SERIALIZE(hash)
|
|
||||||
END_KV_SERIALIZE_MAP()
|
|
||||||
};
|
|
||||||
|
|
||||||
struct t_hash_json {
|
bool create_checkpoints(cryptonote::checkpoints& checkpoints);
|
||||||
std::vector<t_hashline> hashlines;
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
|
||||||
KV_SERIALIZE(hashlines)
|
|
||||||
END_KV_SERIALIZE_MAP()
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace cryptonote {
|
bool load_checkpoints_from_json(cryptonote::checkpoints& checkpoints, std::string json_hashfile_fullpath);
|
||||||
inline bool create_checkpoints(cryptonote::checkpoints& checkpoints)
|
|
||||||
{
|
|
||||||
ADD_CHECKPOINT(1, "771fbcd656ec1464d3a02ead5e18644030007a0fc664c0a964d30922821a8148");
|
|
||||||
ADD_CHECKPOINT(10, "c0e3b387e47042f72d8ccdca88071ff96bff1ac7cde09ae113dbb7ad3fe92381");
|
|
||||||
ADD_CHECKPOINT(100, "ac3e11ca545e57c49fca2b4e8c48c03c23be047c43e471e1394528b1f9f80b2d");
|
|
||||||
ADD_CHECKPOINT(1000, "5acfc45acffd2b2e7345caf42fa02308c5793f15ec33946e969e829f40b03876");
|
|
||||||
ADD_CHECKPOINT(10000, "c758b7c81f928be3295d45e230646de8b852ec96a821eac3fea4daf3fcac0ca2");
|
|
||||||
ADD_CHECKPOINT(22231, "7cb10e29d67e1c069e6e11b17d30b809724255fee2f6868dc14cfc6ed44dfb25");
|
|
||||||
ADD_CHECKPOINT(29556, "53c484a8ed91e4da621bb2fa88106dbde426fe90d7ef07b9c1e5127fb6f3a7f6");
|
|
||||||
ADD_CHECKPOINT(50000, "0fe8758ab06a8b9cb35b7328fd4f757af530a5d37759f9d3e421023231f7b31c");
|
|
||||||
ADD_CHECKPOINT(80000, "a62dcd7b536f22e003ebae8726e9e7276f63d594e264b6f0cd7aab27b66e75e3");
|
|
||||||
ADD_CHECKPOINT(202612, "bbd604d2ba11ba27935e006ed39c9bfdd99b76bf4a50654bc1e1e61217962698");
|
|
||||||
ADD_CHECKPOINT(202613, "e2aa337e78df1f98f462b3b1e560c6b914dec47b610698b7b7d1e3e86b6197c2");
|
|
||||||
ADD_CHECKPOINT(202614, "c29e3dc37d8da3e72e506e31a213a58771b24450144305bcba9e70fa4d6ea6fb");
|
|
||||||
ADD_CHECKPOINT(205000, "5d3d7a26e6dc7535e34f03def711daa8c263785f73ec1fadef8a45880fde8063");
|
|
||||||
ADD_CHECKPOINT(220000, "9613f455933c00e3e33ac315cc6b455ee8aa0c567163836858c2d9caff111553");
|
|
||||||
ADD_CHECKPOINT(230300, "bae7a80c46859db355556e3a9204a337ae8f24309926a1312323fdecf1920e61");
|
|
||||||
ADD_CHECKPOINT(230700, "93e631240ceac831da1aebfc5dac8f722c430463024763ebafa888796ceaeedf");
|
|
||||||
ADD_CHECKPOINT(231350, "b5add137199b820e1ea26640e5c3e121fd85faa86a1e39cf7e6cc097bdeb1131");
|
|
||||||
ADD_CHECKPOINT(232150, "955de8e6b6508af2c24f7334f97beeea651d78e9ade3ab18fec3763be3201aa8");
|
|
||||||
|
|
||||||
return true;
|
} // namespace cryptonote
|
||||||
}
|
|
||||||
|
|
||||||
inline bool load_checkpoins_from_json(cryptonote::checkpoints& checkpoints, std::string json_hashfile_fullpath)
|
|
||||||
{
|
|
||||||
boost::system::error_code errcode;
|
|
||||||
if (! (boost::filesystem::exists(json_hashfile_fullpath, errcode)))
|
|
||||||
{
|
|
||||||
LOG_PRINT_L0("Blockchain checkpoints file not found");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_PRINT_L0("Adding checkpoints from blockchain hashfile");
|
|
||||||
|
|
||||||
uint64_t prev_max_height = checkpoints.get_max_height();
|
|
||||||
LOG_PRINT_L0("Hard-coded max checkpoint height is " << prev_max_height);
|
|
||||||
t_hash_json hashes;
|
|
||||||
epee::serialization::load_t_from_json_file(hashes, json_hashfile_fullpath);
|
|
||||||
for (std::vector<t_hashline>::const_iterator it = hashes.hashlines.begin(); it != hashes.hashlines.end(); )
|
|
||||||
{
|
|
||||||
uint64_t height;
|
|
||||||
height = it->height;
|
|
||||||
if (height <= prev_max_height) {
|
|
||||||
LOG_PRINT_L0("ignoring checkpoint height " << height);
|
|
||||||
} else {
|
|
||||||
std::string blockhash = it->hash;
|
|
||||||
LOG_PRINT_L0("Adding checkpoint height " << height << ", hash=" << blockhash);
|
|
||||||
ADD_CHECKPOINT(height, blockhash);
|
|
||||||
}
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -69,6 +69,21 @@ namespace cryptonote
|
||||||
void core::set_checkpoints(checkpoints&& chk_pts)
|
void core::set_checkpoints(checkpoints&& chk_pts)
|
||||||
{
|
{
|
||||||
m_blockchain_storage.set_checkpoints(std::move(chk_pts));
|
m_blockchain_storage.set_checkpoints(std::move(chk_pts));
|
||||||
|
m_last_checkpoints_update = time(NULL);
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------------
|
||||||
|
void core::set_checkpoints_file_path(const std::string& path)
|
||||||
|
{
|
||||||
|
m_checkpoints_path = path;
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
void core::update_checkpoints()
|
||||||
|
{
|
||||||
|
if (time(NULL) - m_last_checkpoints_update >= 3600)
|
||||||
|
{
|
||||||
|
m_blockchain_storage.update_checkpoints(m_checkpoints_path);
|
||||||
|
m_last_checkpoints_update = time(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
void core::init_options(boost::program_options::options_description& /*desc*/)
|
void core::init_options(boost::program_options::options_description& /*desc*/)
|
||||||
|
@ -418,6 +433,7 @@ namespace cryptonote
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::handle_incoming_block(const blobdata& block_blob, block_verification_context& bvc, bool update_miner_blocktemplate)
|
bool core::handle_incoming_block(const blobdata& block_blob, block_verification_context& bvc, bool update_miner_blocktemplate)
|
||||||
{
|
{
|
||||||
|
update_checkpoints();
|
||||||
bvc = boost::value_initialized<block_verification_context>();
|
bvc = boost::value_initialized<block_verification_context>();
|
||||||
if(block_blob.size() > get_max_block_size())
|
if(block_blob.size() > get_max_block_size())
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
#include <boost/program_options/options_description.hpp>
|
#include <boost/program_options/options_description.hpp>
|
||||||
#include <boost/program_options/variables_map.hpp>
|
#include <boost/program_options/variables_map.hpp>
|
||||||
|
|
||||||
|
@ -92,6 +94,7 @@ namespace cryptonote
|
||||||
|
|
||||||
void set_cryptonote_protocol(i_cryptonote_protocol* pprotocol);
|
void set_cryptonote_protocol(i_cryptonote_protocol* pprotocol);
|
||||||
void set_checkpoints(checkpoints&& chk_pts);
|
void set_checkpoints(checkpoints&& chk_pts);
|
||||||
|
void set_checkpoints_file_path(const std::string& path);
|
||||||
|
|
||||||
bool get_pool_transactions(std::list<transaction>& txs);
|
bool get_pool_transactions(std::list<transaction>& txs);
|
||||||
size_t get_pool_transactions_count();
|
size_t get_pool_transactions_count();
|
||||||
|
@ -120,6 +123,8 @@ namespace cryptonote
|
||||||
uint64_t get_target_blockchain_height() const;
|
uint64_t get_target_blockchain_height() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void update_checkpoints();
|
||||||
|
|
||||||
bool add_new_tx(const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block);
|
bool add_new_tx(const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block);
|
||||||
bool add_new_tx(const transaction& tx, tx_verification_context& tvc, bool keeped_by_block);
|
bool add_new_tx(const transaction& tx, tx_verification_context& tvc, bool keeped_by_block);
|
||||||
bool add_new_block(const block& b, block_verification_context& bvc);
|
bool add_new_block(const block& b, block_verification_context& bvc);
|
||||||
|
@ -155,6 +160,9 @@ namespace cryptonote
|
||||||
std::atomic<bool> m_starter_message_showed;
|
std::atomic<bool> m_starter_message_showed;
|
||||||
|
|
||||||
uint64_t m_target_blockchain_height;
|
uint64_t m_target_blockchain_height;
|
||||||
|
|
||||||
|
std::string m_checkpoints_path;
|
||||||
|
time_t m_last_checkpoints_update;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ int main(int argc, char* argv[])
|
||||||
CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize checkpoints");
|
CHECK_AND_ASSERT_MES(res, 1, "Failed to initialize checkpoints");
|
||||||
boost::filesystem::path json(JSON_HASH_FILE_NAME);
|
boost::filesystem::path json(JSON_HASH_FILE_NAME);
|
||||||
boost::filesystem::path checkpoint_json_hashfile_fullpath = data_dir / json;
|
boost::filesystem::path checkpoint_json_hashfile_fullpath = data_dir / json;
|
||||||
res = cryptonote::load_checkpoins_from_json(checkpoints, checkpoint_json_hashfile_fullpath.string().c_str());
|
res = cryptonote::load_checkpoints_from_json(checkpoints, checkpoint_json_hashfile_fullpath.string().c_str());
|
||||||
CHECK_AND_ASSERT_MES(res, 1, "Failed to load initial checkpoints");
|
CHECK_AND_ASSERT_MES(res, 1, "Failed to load initial checkpoints");
|
||||||
|
|
||||||
//create objects and link them
|
//create objects and link them
|
||||||
|
@ -216,6 +216,7 @@ int main(int argc, char* argv[])
|
||||||
LOG_PRINT_L0("Starting in testnet mode!");
|
LOG_PRINT_L0("Starting in testnet mode!");
|
||||||
} else {
|
} else {
|
||||||
ccore.set_checkpoints(std::move(checkpoints));
|
ccore.set_checkpoints(std::move(checkpoints));
|
||||||
|
ccore.set_checkpoints_file_path(checkpoint_json_hashfile_fullpath.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
cryptonote::t_cryptonote_protocol_handler<cryptonote::core> cprotocol(ccore, NULL);
|
cryptonote::t_cryptonote_protocol_handler<cryptonote::core> cprotocol(ccore, NULL);
|
||||||
|
|
|
@ -252,7 +252,9 @@ namespace nodetool
|
||||||
// for some time yet.
|
// for some time yet.
|
||||||
for (const std::string& addr_str : m_seed_nodes_list)
|
for (const std::string& addr_str : m_seed_nodes_list)
|
||||||
{
|
{
|
||||||
std::vector<std::string> addr_list = tools::DNSResolver::instance().get_ipv4(addr_str);
|
// TODO: care about dnssec avail/valid
|
||||||
|
bool avail, valid;
|
||||||
|
std::vector<std::string> addr_list = tools::DNSResolver::instance().get_ipv4(addr_str, avail, valid);
|
||||||
for (const std::string& a : addr_list)
|
for (const std::string& a : addr_list)
|
||||||
{
|
{
|
||||||
append_net_address(m_seed_nodes, a + ":18080");
|
append_net_address(m_seed_nodes, a + ":18080");
|
||||||
|
|
|
@ -105,6 +105,7 @@ TEST(DNSResolver, IPv6Failure)
|
||||||
|
|
||||||
TEST(DNSResolver, GetTXTRecord)
|
TEST(DNSResolver, GetTXTRecord)
|
||||||
{
|
{
|
||||||
|
bool avail, valid;
|
||||||
|
|
||||||
std::vector<std::string> records = tools::DNSResolver::instance().get_txt_record("donate.monero.cc", avail, valid);
|
std::vector<std::string> records = tools::DNSResolver::instance().get_txt_record("donate.monero.cc", avail, valid);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue