diff options
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/blockchain_storage.cpp | 6 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain_storage.cpp b/src/cryptonote_core/blockchain_storage.cpp index 5dfda08ba..1165a9035 100644 --- a/src/cryptonote_core/blockchain_storage.cpp +++ b/src/cryptonote_core/blockchain_storage.cpp @@ -1793,6 +1793,12 @@ bool blockchain_storage::update_checkpoints(const std::string& file_path) for (const auto& pt : points) { + // if the checkpoint is for a block we don't have yet, move on + if (pt.first >= m_blocks.size()) + { + continue; + } + if (!m_checkpoints.check_block(pt.first, get_block_hash(m_blocks[pt.first].bl))) { // if we're enforcing dns checkpoints, roll back to a couple of blocks before the checkpoint diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 1dbc7bf52..d14be252b 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -150,6 +150,10 @@ namespace cryptonote r = m_blockchain_storage.init(m_config_folder, testnet); CHECK_AND_ASSERT_MES(r, false, "Failed to initialize blockchain storage"); + // load json & DNS checkpoints, and verify them + // with respect to what blocks we already have + update_checkpoints(); + r = m_miner.init(vm, testnet); CHECK_AND_ASSERT_MES(r, false, "Failed to initialize blockchain storage"); |