diff options
| author | iamsmooth <ec2-user@ip-172-31-20-13.ap-northeast-1.compute.internal> | 2014-09-06 10:06:54 +0000 |
|---|---|---|
| committer | fluffypony <ric@spagni.net> | 2014-09-06 21:56:29 +0200 |
| commit | 480cf9668f4c98f388511dce20bc6811fef19a29 (patch) | |
| tree | 40d8aa0eb953864b01e737bf5a7bc4be65cc2406 /src/cryptonote_core/blockchain_storage.cpp | |
| parent | 2ef0aee81d20c002ed50d6dec4baceee1ac40b44 (diff) | |
| download | monzero-core-480cf9668f4c98f388511dce20bc6811fef19a29.tar.gz monzero-core-480cf9668f4c98f388511dce20bc6811fef19a29.tar.xz monzero-core-480cf9668f4c98f388511dce20bc6811fef19a29.zip | |
checkpoints on restore; currently fails on 212 checkpoint
Diffstat (limited to 'src/cryptonote_core/blockchain_storage.cpp')
| -rw-r--r-- | src/cryptonote_core/blockchain_storage.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/cryptonote_core/blockchain_storage.cpp b/src/cryptonote_core/blockchain_storage.cpp index e47c35ea5..932733c3b 100644 --- a/src/cryptonote_core/blockchain_storage.cpp +++ b/src/cryptonote_core/blockchain_storage.cpp @@ -88,7 +88,25 @@ bool blockchain_storage::init(const std::string& config_folder) m_config_folder = config_folder; LOG_PRINT_L0("Loading blockchain..."); const std::string filename = m_config_folder + "/" CRYPTONOTE_BLOCKCHAINDATA_FILENAME; - if(!tools::unserialize_obj_from_file(*this, filename)) + if(tools::unserialize_obj_from_file(*this, filename)) + { + + // checkpoints + + // mainchain + for (size_t height=0; height < m_blocks.size(); ++height) + { + CHECK_AND_ASSERT_MES(m_checkpoints.is_in_checkpoint_zone(height) && m_checkpoints.check_block(height,get_block_hash(m_blocks[height].bl)),false,"checkpoint fail, blockchain.bin invalid"); + } + + // check alt chains + BOOST_FOREACH(blocks_ext_by_hash::value_type& alt_block, m_alternative_chains) + { + CHECK_AND_ASSERT_MES(m_checkpoints.is_alternative_block_allowed(m_blocks.size()-1,alt_block.second.height),false,"stored alternative block not allowed, blockchain.bin invalid"); + } + + } + else { LOG_PRINT_L0("Can't load blockchain storage from file, generating genesis block."); block bl = boost::value_initialized<block>(); @@ -743,7 +761,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto:: return false; } - //block is not related with head of main chain + //Block is not related with head of main chain //first of all - look in alternative chains container auto it_main_prev = m_blocks_index.find(b.prev_id); auto it_prev = m_alternative_chains.find(b.prev_id); |
