From 8e7c7af05f3833b308d61092b4746e436a0a876d Mon Sep 17 00:00:00 2001 From: SChernykh Date: Thu, 22 Sep 2022 13:04:50 +0200 Subject: Move update_checkpoints() to a later stage update_checkpoints() makes a few DNS requests and can take up to 20-30 seconds to complete (3-6 seconds on average). It is currently called from core::handle_incoming_block() which holds m_incoming_tx_lock, so it blocks all incoming transactions and blocks processing while update_checkpoints() is running. This PR moves it to until after a new block has been processed and relayed, to avoid full monerod locking. --- tests/core_proxy/core_proxy.h | 1 + tests/unit_tests/node_server.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/core_proxy/core_proxy.h b/tests/core_proxy/core_proxy.h index fe10dde6e..6d0597ad9 100644 --- a/tests/core_proxy/core_proxy.h +++ b/tests/core_proxy/core_proxy.h @@ -90,6 +90,7 @@ namespace tests bool get_test_drop_download_height() {return true;} bool prepare_handle_incoming_blocks(const std::vector &blocks_entry, std::vector &blocks) { return true; } bool cleanup_handle_incoming_blocks(bool force_sync = false) { return true; } + bool update_checkpoints(const bool skip_dns = false) { return true; } uint64_t get_target_blockchain_height() const { return 1; } size_t get_block_sync_size(uint64_t height) const { return BLOCKS_SYNCHRONIZING_DEFAULT_COUNT; } virtual void on_transactions_relayed(epee::span tx_blobs, cryptonote::relay_method tx_relay) {} diff --git a/tests/unit_tests/node_server.cpp b/tests/unit_tests/node_server.cpp index 6c8cd9f8d..584f98f7a 100644 --- a/tests/unit_tests/node_server.cpp +++ b/tests/unit_tests/node_server.cpp @@ -72,6 +72,7 @@ public: bool get_test_drop_download_height() const {return true;} bool prepare_handle_incoming_blocks(const std::vector &blocks_entry, std::vector &blocks) { return true; } bool cleanup_handle_incoming_blocks(bool force_sync = false) { return true; } + bool update_checkpoints(const bool skip_dns = false) { return true; } uint64_t get_target_blockchain_height() const { return 1; } size_t get_block_sync_size(uint64_t height) const { return BLOCKS_SYNCHRONIZING_DEFAULT_COUNT; } virtual void on_transactions_relayed(epee::span tx_blobs, cryptonote::relay_method tx_relay) {} -- cgit v1.2.3