diff options
author | mydesktop <dev.mc2@gmail.com> | 2014-05-28 21:13:32 -0400 |
---|---|---|
committer | mydesktop <dev.mc2@gmail.com> | 2014-05-28 21:13:32 -0400 |
commit | 5c1b7c72249a114b1c30945fc8a9116c07573a48 (patch) | |
tree | 5e110e349a1f4dccd33867fecbbc4a2c51fc312d /src/cryptonote_core/checkpoints.cpp | |
parent | raise min fee and correct COIN value (diff) | |
parent | typo in tx_pool.cpp (diff) | |
download | monero-5c1b7c72249a114b1c30945fc8a9116c07573a48.tar.xz |
Merge branch '0.8.8update'
Update to newest version 0.8.8. See change log for details.
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; + } } |