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 | |
parent | Fix tree-hash cnt n^2. Asserts, comment. Squash2 (diff) | |
download | monero-480cf9668f4c98f388511dce20bc6811fef19a29.tar.xz |
checkpoints on restore; currently fails on 212 checkpoint
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/blockchain_storage.cpp | 22 | ||||
-rw-r--r-- | src/cryptonote_core/checkpoints_create.h | 4 |
2 files changed, 24 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); diff --git a/src/cryptonote_core/checkpoints_create.h b/src/cryptonote_core/checkpoints_create.h index 932f31da0..fe77ccd0d 100644 --- a/src/cryptonote_core/checkpoints_create.h +++ b/src/cryptonote_core/checkpoints_create.h @@ -42,6 +42,10 @@ namespace cryptonote { ADD_CHECKPOINT(29556, "53c484a8ed91e4da621bb2fa88106dbde426fe90d7ef07b9c1e5127fb6f3a7f6"); ADD_CHECKPOINT(50000, "0fe8758ab06a8b9cb35b7328fd4f757af530a5d37759f9d3e421023231f7b31c"); ADD_CHECKPOINT(80000, "a62dcd7b536f22e003ebae8726e9e7276f63d594e264b6f0cd7aab27b66e75e3"); + ADD_CHECKPOINT(202212, "bbd604d2ba11ba27935e006ed39c9bfdd99b76bf4a50654bc1e1e61217962698"); + ADD_CHECKPOINT(202213, "44c921da50148949853df082c16f5f8e603ab2f9d599c8aee0f0a3f4abc4fb09"); // from chainradar; verify this + ADD_CHECKPOINT(202214, "043ce17bab57777d04423a65fd60487d02750cbdef11192dca97f1fa6dae654c"); // from chainradar; verify this + ADD_CHECKPOINT(205000, "5d3d7a26e6dc7535e34f03def711daa8c263785f73ec1fadef8a45880fde8063"); // from chainradar; verify this return true; } } |