mirror of
https://github.com/monero-project/monero.git
synced 2025-07-30 06:48:41 -04:00
daemon: add '--no-sync' arg to optionally disable blockchain sync
This commit is contained in:
parent
31bdf7bd11
commit
a54e81e572
5 changed files with 17 additions and 1 deletions
|
@ -111,6 +111,7 @@ namespace cryptonote
|
|||
void stop();
|
||||
void on_connection_close(cryptonote_connection_context &context);
|
||||
void set_max_out_peers(unsigned int max) { m_max_out_peers = max; }
|
||||
void set_no_sync(bool value) { m_no_sync = value; }
|
||||
std::string get_peers_overview() const;
|
||||
std::pair<uint32_t, uint32_t> get_next_needed_pruning_stripe() const;
|
||||
bool needs_new_sync_connections() const;
|
||||
|
@ -149,6 +150,7 @@ namespace cryptonote
|
|||
std::atomic<uint32_t> m_syncronized_connections_count;
|
||||
std::atomic<bool> m_synchronized;
|
||||
std::atomic<bool> m_stopping;
|
||||
std::atomic<bool> m_no_sync;
|
||||
boost::mutex m_sync_lock;
|
||||
block_queue m_block_queue;
|
||||
epee::math_helper::once_a_time_seconds<30> m_idle_peer_kicker;
|
||||
|
|
|
@ -72,7 +72,8 @@ namespace cryptonote
|
|||
m_p2p(p_net_layout),
|
||||
m_syncronized_connections_count(0),
|
||||
m_synchronized(offline),
|
||||
m_stopping(false)
|
||||
m_stopping(false),
|
||||
m_no_sync(false)
|
||||
|
||||
{
|
||||
if(!m_p2p)
|
||||
|
@ -374,6 +375,13 @@ namespace cryptonote
|
|||
m_core.set_target_blockchain_height((hshd.current_height));
|
||||
}
|
||||
MINFO(context << "Remote blockchain height: " << hshd.current_height << ", id: " << hshd.top_id);
|
||||
|
||||
if (m_no_sync)
|
||||
{
|
||||
context.m_state = cryptonote_connection_context::state_normal;
|
||||
return true;
|
||||
}
|
||||
|
||||
context.m_state = cryptonote_connection_context::state_synchronizing;
|
||||
//let the socket to send response to handshake, but request callback, to let send request data after response
|
||||
LOG_PRINT_CCONTEXT_L2("requesting callback");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue