diff options
author | Thomas Winget <tewinget@gmail.com> | 2014-09-24 18:43:03 -0400 |
---|---|---|
committer | Thomas Winget <tewinget@gmail.com> | 2014-09-30 16:17:26 -0400 |
commit | 6f2c2e1c27254116f979ec244cf3383d2ea87fad (patch) | |
tree | 1673eecf896006f364e60fe05b8b8ede537e1c7f /src | |
parent | Merge pull request #163 (diff) | |
download | monero-6f2c2e1c27254116f979ec244cf3383d2ea87fad.tar.xz |
Adding an identical existing checkpoint should not error
For checkpoints being read at runtime to work correctly, the checkpoint
add code needs to not return false if a checkpoint is added that already
exists. In this case, instead return false if the checkpoint is for a
height that already has a checkpoint and the hashes are different.
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptonote_core/checkpoints.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/cryptonote_core/checkpoints.cpp b/src/cryptonote_core/checkpoints.cpp index c76a23841..8e4144a0a 100644 --- a/src/cryptonote_core/checkpoints.cpp +++ b/src/cryptonote_core/checkpoints.cpp @@ -44,8 +44,13 @@ namespace cryptonote { crypto::hash h = null_hash; bool r = epee::string_tools::parse_tpod_from_hex_string(hash_str, h); - CHECK_AND_ASSERT_MES(r, false, "WRONG HASH IN CHECKPOINTS!!!"); - CHECK_AND_ASSERT_MES(0 == m_points.count(height), false, "WRONG HASH IN CHECKPOINTS!!!"); + CHECK_AND_ASSERT_MES(r, false, "Failed to parse checkpoint hash string into binary representation!"); + + // return false if adding at a height we already have AND the hash is different + if (m_points.count(height)) + { + CHECK_AND_ASSERT_MES(h == m_points[height], false, "Checkpoint at given height already exists, and hash for new checkpoint was different!"); + } m_points[height] = h; return true; } |