mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 16:27:39 +00:00
Merge pull request #5195
a54e81e5
daemon: add '--no-sync' arg to optionally disable blockchain sync (xiphon)
This commit is contained in:
commit
bf0f85221b
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)
|
||||
|
@ -376,6 +377,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");
|
||||
|
|
|
@ -132,6 +132,7 @@ namespace nodetool
|
|||
const command_line::arg_descriptor<std::vector<std::string> > arg_proxy = {"proxy", "<network-type>,<socks-ip:port>[,max_connections] i.e. \"tor,127.0.0.1:9050,100\""};
|
||||
const command_line::arg_descriptor<std::vector<std::string> > arg_anonymous_inbound = {"anonymous-inbound", "<hidden-service-address>,<[bind-ip:]port>[,max_connections] i.e. \"x.onion,127.0.0.1:18083,100\""};
|
||||
const command_line::arg_descriptor<bool> arg_p2p_hide_my_port = {"hide-my-port", "Do not announce yourself as peerlist candidate", false, true};
|
||||
const command_line::arg_descriptor<bool> arg_no_sync = {"no-sync", "Don't synchronize the blockchain with other peers", false};
|
||||
|
||||
const command_line::arg_descriptor<bool> arg_no_igd = {"no-igd", "Disable UPnP port mapping"};
|
||||
const command_line::arg_descriptor<int64_t> arg_out_peers = {"out-peers", "set max number of out peers", -1};
|
||||
|
|
|
@ -489,6 +489,7 @@ namespace nodetool
|
|||
extern const command_line::arg_descriptor<std::vector<std::string> > arg_proxy;
|
||||
extern const command_line::arg_descriptor<std::vector<std::string> > arg_anonymous_inbound;
|
||||
extern const command_line::arg_descriptor<bool> arg_p2p_hide_my_port;
|
||||
extern const command_line::arg_descriptor<bool> arg_no_sync;
|
||||
|
||||
extern const command_line::arg_descriptor<bool> arg_no_igd;
|
||||
extern const command_line::arg_descriptor<bool> arg_offline;
|
||||
|
|
|
@ -103,6 +103,7 @@ namespace nodetool
|
|||
command_line::add_arg(desc, arg_proxy);
|
||||
command_line::add_arg(desc, arg_anonymous_inbound);
|
||||
command_line::add_arg(desc, arg_p2p_hide_my_port);
|
||||
command_line::add_arg(desc, arg_no_sync);
|
||||
command_line::add_arg(desc, arg_no_igd);
|
||||
command_line::add_arg(desc, arg_out_peers);
|
||||
command_line::add_arg(desc, arg_in_peers);
|
||||
|
@ -310,6 +311,9 @@ namespace nodetool
|
|||
if(command_line::has_arg(vm, arg_p2p_hide_my_port))
|
||||
m_hide_my_port = true;
|
||||
|
||||
if (command_line::has_arg(vm, arg_no_sync))
|
||||
m_payload_handler.set_no_sync(true);
|
||||
|
||||
if ( !set_max_out_peers(public_zone, command_line::get_arg(vm, arg_out_peers) ) )
|
||||
return false;
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue