diff options
author | NoodleDoodleNoodleDoodleNoodleDoodleNoo <xeven77@outlook.com> | 2014-06-16 03:32:09 -0700 |
---|---|---|
committer | NoodleDoodleNoodleDoodleNoodleDoodleNoo <xeven77@outlook.com> | 2014-06-16 03:32:09 -0700 |
commit | 8fc42a21fc8ff4528c59e206b24d974982332964 (patch) | |
tree | a0d9934ca8675afe4bbe5594f2b9694867eb73b6 /src/cryptonote_core/checkpoints.cpp | |
parent | Revert "Update slow-hash.c" (diff) | |
parent | Merge pull request #33 from mikezackles/arch_linux_build_fixes (diff) | |
download | monero-8fc42a21fc8ff4528c59e206b24d974982332964.tar.xz |
Merge branch 'master' of https://github.com/monero-project/bitmonero
Diffstat (limited to 'src/cryptonote_core/checkpoints.cpp')
-rw-r--r-- | src/cryptonote_core/checkpoints.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/cryptonote_core/checkpoints.cpp b/src/cryptonote_core/checkpoints.cpp index 54c2f3a6d..33a2d2986 100644 --- a/src/cryptonote_core/checkpoints.cpp +++ b/src/cryptonote_core/checkpoints.cpp @@ -29,10 +29,11 @@ namespace cryptonote return !m_points.empty() && (height <= (--m_points.end())->first); } //--------------------------------------------------------------------------- - bool checkpoints::check_block(uint64_t height, const crypto::hash& h) const + bool checkpoints::check_block(uint64_t height, const crypto::hash& h, bool& is_a_checkpoint) const { auto it = m_points.find(height); - if(it == m_points.end()) + is_a_checkpoint = it != m_points.end(); + if(!is_a_checkpoint) return true; if(it->second == h) @@ -45,4 +46,25 @@ namespace cryptonote return false; } } + //--------------------------------------------------------------------------- + bool checkpoints::check_block(uint64_t height, const crypto::hash& h) const + { + bool ignored; + return check_block(height, h, ignored); + } + //--------------------------------------------------------------------------- + bool checkpoints::is_alternative_block_allowed(uint64_t blockchain_height, uint64_t block_height) const + { + if (0 == block_height) + return false; + + auto it = m_points.upper_bound(blockchain_height); + // Is blockchain_height before the first checkpoint? + if (it == m_points.begin()) + return true; + + --it; + uint64_t checkpoint_height = it->first; + return checkpoint_height < block_height; + } } |