diff options
author | Thomas Winget <tewinget@gmail.com> | 2014-09-25 01:15:28 -0400 |
---|---|---|
committer | Thomas Winget <tewinget@gmail.com> | 2014-09-30 16:21:37 -0400 |
commit | 30caebfce3a2445b809125a541cc9958b07d02f5 (patch) | |
tree | 64b640979d79d553dd3be7554154373afd7e98e4 /src/cryptonote_core/blockchain_storage.cpp | |
parent | updated DNSResolver/things that use it for DNSSEC (diff) | |
download | monero-30caebfce3a2445b809125a541cc9958b07d02f5.tar.xz |
reload checkpoints file every ~hr and print if any fail
also some other minor bug squashing and code formatting
Diffstat (limited to 'src/cryptonote_core/blockchain_storage.cpp')
-rw-r--r-- | src/cryptonote_core/blockchain_storage.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain_storage.cpp b/src/cryptonote_core/blockchain_storage.cpp index e664a39c5..90820232c 100644 --- a/src/cryptonote_core/blockchain_storage.cpp +++ b/src/cryptonote_core/blockchain_storage.cpp @@ -47,6 +47,7 @@ #include "common/boost_serialization_helper.h" #include "warnings.h" #include "crypto/hash.h" +#include "cryptonote_core/checkpoints_create.h" //#include "serialization/json_archive.h" 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); } +//------------------------------------------------------------------ +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."); + } + } +} |