mirror of
https://github.com/jwinterm/aeon.git
synced 2026-10-17 05:01:26 +02:00
verify checkpoints upon loading saved blockchain (from Monero); add recent checkpoint
This commit is contained in:
@@ -89,7 +89,17 @@ 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");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_PRINT_L0("Can't load blockchain storage from file, generating genesis block.");
|
||||
block bl = boost::value_initialized<block>();
|
||||
@@ -98,6 +108,7 @@ bool blockchain_storage::init(const std::string& config_folder)
|
||||
add_new_block(bl, bvc);
|
||||
CHECK_AND_ASSERT_MES(!bvc.m_verifivation_failed && bvc.m_added_to_main_chain, false, "Failed to add genesis block to blockchain");
|
||||
}
|
||||
|
||||
if(!m_blocks.size())
|
||||
{
|
||||
LOG_PRINT_L0("Blockchain not loaded, generating genesis block.");
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace cryptonote {
|
||||
ADD_CHECKPOINT(10000, "1ac1ebd25baf0d6ec593daa3389f1aa7e860ff2cc29f3cf1be586d245b379da4");
|
||||
ADD_CHECKPOINT(15000, "15567af42afc1ed00538f53b5e3822d421e3ed6372ca79f4ea4e3e3bab709a87");
|
||||
ADD_CHECKPOINT(175500, "3f7dd748b3b863b04654d87a387f2b65a365f467188971f3192eab2368e64a35");
|
||||
ADD_CHECKPOINT(450000, "f69a6e57c4dd5df2f492c9d31c50f11aad2c25a64d540ce5f5d11b572aec8ab7");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user