From ba2fefb9a4280c26f3046da78aaee812228ee7a5 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 10 Dec 2017 15:05:48 +0000 Subject: checkpoints: pass std::string by const ref, not const value --- src/checkpoints/checkpoints.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/checkpoints/checkpoints.cpp') diff --git a/src/checkpoints/checkpoints.cpp b/src/checkpoints/checkpoints.cpp index c66c4f5d6..e6253c73d 100644 --- a/src/checkpoints/checkpoints.cpp +++ b/src/checkpoints/checkpoints.cpp @@ -204,7 +204,7 @@ namespace cryptonote return true; } - bool checkpoints::load_checkpoints_from_json(const std::string json_hashfile_fullpath) + bool checkpoints::load_checkpoints_from_json(const std::string &json_hashfile_fullpath) { boost::system::error_code errcode; if (! (boost::filesystem::exists(json_hashfile_fullpath, errcode))) @@ -286,7 +286,7 @@ namespace cryptonote return true; } - bool checkpoints::load_new_checkpoints(const std::string json_hashfile_fullpath, bool testnet, bool dns) + bool checkpoints::load_new_checkpoints(const std::string &json_hashfile_fullpath, bool testnet, bool dns) { bool result; -- cgit v1.2.3 From 061789b5dd8a84e6914ed8536e8bd66c656a63e5 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 10 Dec 2017 15:06:04 +0000 Subject: checkpoints: trap failure to load JSON checkpoints --- src/checkpoints/checkpoints.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/checkpoints/checkpoints.cpp') diff --git a/src/checkpoints/checkpoints.cpp b/src/checkpoints/checkpoints.cpp index e6253c73d..67a313bc2 100644 --- a/src/checkpoints/checkpoints.cpp +++ b/src/checkpoints/checkpoints.cpp @@ -218,7 +218,11 @@ namespace cryptonote uint64_t prev_max_height = get_max_height(); LOG_PRINT_L1("Hard-coded max checkpoint height is " << prev_max_height); t_hash_json hashes; - epee::serialization::load_t_from_json_file(hashes, json_hashfile_fullpath); + if (!epee::serialization::load_t_from_json_file(hashes, json_hashfile_fullpath)) + { + MERROR("Error loading checkpoints from " << json_hashfile_fullpath); + return false; + } for (std::vector::const_iterator it = hashes.hashlines.begin(); it != hashes.hashlines.end(); ) { uint64_t height; -- cgit v1.2.3