mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 16:27:39 +00:00
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.
This commit is contained in:
parent
e00f0551e0
commit
6f2c2e1c27
1 changed files with 7 additions and 2 deletions
|
@ -44,8 +44,13 @@ namespace cryptonote
|
||||||
{
|
{
|
||||||
crypto::hash h = null_hash;
|
crypto::hash h = null_hash;
|
||||||
bool r = epee::string_tools::parse_tpod_from_hex_string(hash_str, h);
|
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(r, false, "Failed to parse checkpoint hash string into binary representation!");
|
||||||
CHECK_AND_ASSERT_MES(0 == m_points.count(height), false, "WRONG HASH IN CHECKPOINTS!!!");
|
|
||||||
|
// 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;
|
m_points[height] = h;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue