diff options
| author | paybee <dev@payb.ee> | 2014-05-29 17:53:49 +0200 |
|---|---|---|
| committer | paybee <dev@payb.ee> | 2014-05-29 17:53:49 +0200 |
| commit | 0e5223321258d8fa6bbb7190ecb2b230a801aac2 (patch) | |
| tree | acbd51dac3256b47bab6c1b98d21a3434b7158b7 /src/cryptonote_core/checkpoints.cpp | |
| parent | feacdded6b48fcfe18bc3218b05b27e94db2fc92 (diff) | |
| parent | 5c1b7c72249a114b1c30945fc8a9116c07573a48 (diff) | |
| download | monzero-core-0e5223321258d8fa6bbb7190ecb2b230a801aac2.tar.gz monzero-core-0e5223321258d8fa6bbb7190ecb2b230a801aac2.tar.xz monzero-core-0e5223321258d8fa6bbb7190ecb2b230a801aac2.zip | |
Merge remote-tracking branch 'upstream/master'
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; + } } |
