Skip to content

Commit 1f27fdf

Browse files
committed
Merge pull request #8588
802c4bb Move update_checkpoints() to a later stage (SChernykh)
2 parents 0bef426 + 802c4bb commit 1f27fdf

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

src/cryptonote_core/cryptonote_core.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,10 +1656,6 @@ namespace cryptonote
16561656
if (((size_t)-1) <= 0xffffffff && block_blob.size() >= 0x3fffffff)
16571657
MWARNING("This block's size is " << block_blob.size() << ", closing on the 32 bit limit");
16581658

1659-
// load json & DNS checkpoints every 10min/hour respectively,
1660-
// and verify them with respect to what blocks we already have
1661-
CHECK_AND_ASSERT_MES(update_checkpoints(), false, "One or more checkpoints loaded from json or dns conflicted with existing checkpoints.");
1662-
16631659
block lb;
16641660
if (!b)
16651661
{

src/cryptonote_protocol/cryptonote_protocol_handler.inl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,10 @@ namespace cryptonote
537537
MLOG_PEER_STATE("requesting chain");
538538
}
539539

540+
// load json & DNS checkpoints every 10min/hour respectively,
541+
// and verify them with respect to what blocks we already have
542+
CHECK_AND_ASSERT_MES(m_core.update_checkpoints(), 1, "One or more checkpoints loaded from json or dns conflicted with existing checkpoints.");
543+
540544
return 1;
541545
}
542546
//------------------------------------------------------------------------------------------------------------------------
@@ -819,6 +823,10 @@ namespace cryptonote
819823
post_notify<NOTIFY_REQUEST_CHAIN>(r, context);
820824
MLOG_PEER_STATE("requesting chain");
821825
}
826+
827+
// load json & DNS checkpoints every 10min/hour respectively,
828+
// and verify them with respect to what blocks we already have
829+
CHECK_AND_ASSERT_MES(m_core.update_checkpoints(), 1, "One or more checkpoints loaded from json or dns conflicted with existing checkpoints.");
822830
}
823831
}
824832
else

tests/core_proxy/core_proxy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ namespace tests
9090
bool get_test_drop_download_height() {return true;}
9191
bool prepare_handle_incoming_blocks(const std::vector<cryptonote::block_complete_entry> &blocks_entry, std::vector<cryptonote::block> &blocks) { return true; }
9292
bool cleanup_handle_incoming_blocks(bool force_sync = false) { return true; }
93+
bool update_checkpoints(const bool skip_dns = false) { return true; }
9394
uint64_t get_target_blockchain_height() const { return 1; }
9495
size_t get_block_sync_size(uint64_t height) const { return BLOCKS_SYNCHRONIZING_DEFAULT_COUNT; }
9596
virtual void on_transactions_relayed(epee::span<const cryptonote::blobdata> tx_blobs, cryptonote::relay_method tx_relay) {}

tests/unit_tests/node_server.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class test_core : public cryptonote::i_core_events
7272
bool get_test_drop_download_height() const {return true;}
7373
bool prepare_handle_incoming_blocks(const std::vector<cryptonote::block_complete_entry> &blocks_entry, std::vector<cryptonote::block> &blocks) { return true; }
7474
bool cleanup_handle_incoming_blocks(bool force_sync = false) { return true; }
75+
bool update_checkpoints(const bool skip_dns = false) { return true; }
7576
uint64_t get_target_blockchain_height() const { return 1; }
7677
size_t get_block_sync_size(uint64_t height) const { return BLOCKS_SYNCHRONIZING_DEFAULT_COUNT; }
7778
virtual void on_transactions_relayed(epee::span<const cryptonote::blobdata> tx_blobs, cryptonote::relay_method tx_relay) {}

0 commit comments

Comments
 (0)