Go to the documentation of this file.
37 #include <boost/program_options/variables_map.hpp>
40 #include "math_helper.h"
41 #include "storages/levin_abstract_invoke2.h"
48 #include <boost/circular_buffer.hpp>
53 #define LOCALHOST_INT 2130706433
54 #define CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT 100
60 class cryptonote_protocol_handler_base_pimpl;
63 std::unique_ptr<cryptonote_protocol_handler_base_pimpl>
mI;
75 template<class t_core>
86 HANDLE_NOTIFY_T2(
NOTIFY_NEW_BLOCK, &cryptonote_protocol_handler::handle_notify_new_block)
103 bool get_payload_sync_data(
blobdata& data);
106 t_core& get_core(){
return m_core;}
108 void log_connections();
109 std::list<connection_info> get_connections();
116 std::string get_peers_overview()
const;
117 std::pair<uint32_t, uint32_t> get_next_needed_pruning_stripe()
const;
118 bool needs_new_sync_connections()
const;
138 size_t get_synchronizing_connections_count();
139 bool on_connection_synchronized();
144 bool kick_idle_peers();
145 bool check_standby_peers();
146 bool update_sync_search();
179 uint64_t get_estimated_remaining_sync_seconds(uint64_t current_blockchain_height, uint64_t target_blockchain_height);
180 std::string get_periodic_sync_estimate(uint64_t current_blockchain_height, uint64_t target_blockchain_height);
184 boost::circular_buffer<size_t> m_avg_buffer = boost::circular_buffer<size_t>(10);
186 template<
class t_parameter>
189 LOG_PRINT_L2(
"[" << epee::net_utils::print_connection_context_short(
context) <<
"] post " <<
typeid(t_parameter).
name() <<
" -->");
191 epee::serialization::store_t_to_binary(arg, blob);
bool post_notify(typename t_parameter::request &arg, cryptonote_connection_context &context)
Definition: cryptonote_protocol_handler.h:187
std::atomic< bool > m_stopping
Definition: cryptonote_protocol_handler.h:158
Definition: connection_context.h:43
relay_method
Methods tracking how a tx was received and relayed.
Definition: enums.h:37
boost::posix_time::ptime m_period_start_time
Definition: cryptonote_protocol_handler.h:176
Definition: cryptonote_protocol_defs.h:193
CORE_SYNC_DATA payload_type
Definition: cryptonote_protocol_handler.h:81
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:227
boost::mutex m_sync_lock
Definition: cryptonote_protocol_handler.h:161
std::atomic< bool > m_synchronized
Definition: cryptonote_protocol_handler.h:157
Definition: cryptonote_protocol_handler.h:61
void set_max_out_peers(unsigned int max)
Definition: cryptonote_protocol_handler.h:113
std::atomic< bool > m_ask_for_txpool_complement
Definition: cryptonote_protocol_handler.h:160
Definition: unordered_containers_boost_serialization.h:38
Definition: cryptonote_protocol_defs.h:363
Definition: cryptonote_protocol_defs.h:290
virtual ~cryptonote_protocol_handler_base()
Definition: cryptonote_protocol_handler-base.cpp:97
Definition: block_queue.h:48
std::atomic< unsigned int > m_max_out_peers
Definition: cryptonote_protocol_handler.h:166
Definition: cryptonote_protocol_defs.h:173
DISABLE_VS_WARNINGS(4244 4345 4503) using namespace crypto
epee::math_helper::once_a_time_milliseconds< 100 > m_standby_checker
Definition: cryptonote_protocol_handler.h:164
Definition: cryptonote_protocol_defs.h:321
static void init(std::string cache_filename)
Definition: blockchain_blackball.cpp:221
const
Definition: build_protob.py:9
uint64_t m_sync_start_height
Definition: cryptonote_protocol_handler.h:177
bool is_synchronized()
Definition: cryptonote_protocol_handler.h:107
Definition: cryptonote_protocol_handler.h:77
Definition: cryptonote_protocol_defs.h:231
boost::posix_time::ptime m_sync_start_time
Definition: cryptonote_protocol_handler.h:175
uint64_t m_sync_download_objects_size
Definition: cryptonote_protocol_handler.h:170
nodetool::p2p_endpoint_stub< connection_context > m_p2p_stub
Definition: cryptonote_protocol_handler.h:154
size_t m_block_download_max_size
Definition: cryptonote_protocol_handler.h:171
uint64_t m_period_start_height
Definition: cryptonote_protocol_handler.h:178
cryptonote_protocol_handler_base()
Definition: cryptonote_protocol_handler-base.cpp:94
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:105
epee::math_helper::once_a_time_seconds< 30 > m_idle_peer_kicker
Definition: cryptonote_protocol_handler.h:163
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:314
Definition: cryptonote_protocol_defs.h:214
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT_PRE_V4
Definition: cryptonote_config.h:96
Holds cryptonote related classes and helpers.
Definition: blockchain_db.cpp:45
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:356
const block_queue & get_block_queue() const
Definition: cryptonote_protocol_handler.h:110
std::atomic< bool > m_no_sync
Definition: cryptonote_protocol_handler.h:159
bool m_sync_pruned_blocks
Definition: cryptonote_protocol_handler.h:172
epee::math_helper::once_a_time_seconds< 101 > m_sync_search_checker
Definition: cryptonote_protocol_handler.h:165
Definition: cryptonote_protocol_defs.h:251
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:374
virtual double estimate_one_block_size() noexcept
Definition: cryptonote_protocol_handler-base.cpp:82
std::string blobdata
Definition: blobdatatype.h:39
std::atomic< uint32_t > m_syncronized_connections_count
Definition: cryptonote_protocol_handler.h:156
int bool
Definition: stdbool.h:35
void set_no_sync(bool value)
Definition: cryptonote_protocol_handler.h:115
virtual double get_avg_block_size()=0
cryptonote_connection_context connection_context
Definition: cryptonote_protocol_handler.h:79
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:286
void handler_request_blocks_history(std::list< crypto::hash > &ids)
Definition: cryptonote_protocol_handler-base.cpp:100
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:186
nodetool::i_p2p_endpoint< connection_context > * m_p2p
Definition: cryptonote_protocol_handler.h:155
bool no_sync() const
Definition: cryptonote_protocol_handler.h:114
uint64_t m_sync_spans_downloaded
Definition: cryptonote_protocol_handler.h:169
Definition: cryptonote_protocol_defs.h:341
Definition: cryptonote_protocol_handler_common.h:42
uint64_t m_last_add_end_time
Definition: cryptonote_protocol_handler.h:168
Definition: cryptonote_protocol_defs.h:273
std::unique_ptr< cryptonote_protocol_handler_base_pimpl > mI
Definition: cryptonote_protocol_handler.h:63
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:246
block_queue m_block_queue
Definition: cryptonote_protocol_handler.h:162
t_core & m_core
Definition: cryptonote_protocol_handler.h:152
PUSH_WARNINGS
Definition: hash-ops.h:53
t_cryptonote_protocol_handler< t_core > cryptonote_protocol_handler
Definition: cryptonote_protocol_handler.h:80
#define CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT
Definition: cryptonote_protocol_handler.h:54
tools::PerformanceTimer m_sync_timer
Definition: cryptonote_protocol_handler.h:167
const char * name
Definition: simplewallet.cpp:417
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:208
void handler_response_blocks_now(size_t packet_size)
Definition: cryptonote_protocol_handler-base.cpp:103
boost::mutex m_buffer_mutex
Definition: cryptonote_protocol_handler.h:182
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:334