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;
119 bool is_busy_syncing();
140 size_t get_synchronizing_connections_count();
141 bool on_connection_synchronized();
146 void drop_connections(
const epee::net_utils::network_address address);
147 bool kick_idle_peers();
148 bool check_standby_peers();
149 bool update_sync_search();
184 uint64_t get_estimated_remaining_sync_seconds(uint64_t current_blockchain_height, uint64_t target_blockchain_height);
185 std::string get_periodic_sync_estimate(uint64_t current_blockchain_height, uint64_t target_blockchain_height);
189 boost::circular_buffer<size_t> m_avg_buffer = boost::circular_buffer<size_t>(10);
193 template<
class t_parameter>
196 LOG_PRINT_L2(
"[" << epee::net_utils::print_connection_context_short(
context) <<
"] post " <<
typeid(t_parameter).
name() <<
" -->");
198 epee::serialization::store_t_to_binary(arg, blob);
nodetool::p2p_endpoint_stub< connection_context > m_p2p_stub
Definition: cryptonote_protocol_handler.h:158
void handler_request_blocks_history(std::list< crypto::hash > &ids)
Definition: cryptonote_protocol_handler-base.cpp:100
uint64_t m_sync_download_objects_size
Definition: cryptonote_protocol_handler.h:175
Definition: block_queue.h:48
virtual double estimate_one_block_size() noexcept
Definition: cryptonote_protocol_handler-base.cpp:82
virtual bool is_synchronized() const final
Definition: cryptonote_protocol_handler.h:107
bool m_sync_pruned_blocks
Definition: cryptonote_protocol_handler.h:177
PUSH_WARNINGS
Definition: hash-ops.h:53
Definition: cryptonote_protocol_defs.h:364
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:208
Definition: unordered_containers_boost_serialization.h:37
const block_queue & get_block_queue() const
Definition: cryptonote_protocol_handler.h:110
static void init(std::string cache_filename)
Definition: blockchain_blackball.cpp:221
std::atomic< bool > m_no_sync
Definition: cryptonote_protocol_handler.h:163
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:316
void set_no_sync(bool value)
Definition: cryptonote_protocol_handler.h:115
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:286
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:227
epee::math_helper::once_a_time_seconds< 101 > m_sync_search_checker
Definition: cryptonote_protocol_handler.h:169
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:376
cryptonote_connection_context connection_context
Definition: cryptonote_protocol_handler.h:79
std::atomic< uint32_t > m_syncronized_connections_count
Definition: cryptonote_protocol_handler.h:160
uint64_t m_sync_spans_downloaded
Definition: cryptonote_protocol_handler.h:174
bool no_sync() const
Definition: cryptonote_protocol_handler.h:114
virtual ~cryptonote_protocol_handler_base()
Definition: cryptonote_protocol_handler-base.cpp:97
Definition: connection_context.h:42
#define CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT
Definition: cryptonote_protocol_handler.h:54
const
Definition: build_protob.py:9
Definition: cryptonote_protocol_defs.h:289
void handler_response_blocks_now(size_t packet_size)
Definition: cryptonote_protocol_handler-base.cpp:103
virtual double get_avg_block_size()=0
Definition: cryptonote_protocol_defs.h:192
t_core & m_core
Definition: cryptonote_protocol_handler.h:156
tools::PerformanceTimer m_sync_timer
Definition: cryptonote_protocol_handler.h:172
nodetool::i_p2p_endpoint< connection_context > * m_p2p
Definition: cryptonote_protocol_handler.h:159
boost::mutex m_buffer_mutex
Definition: cryptonote_protocol_handler.h:187
boost::mutex m_bad_peer_check_lock
Definition: cryptonote_protocol_handler.h:191
uint64_t m_last_add_end_time
Definition: cryptonote_protocol_handler.h:173
Holds cryptonote related classes and helpers.
Definition: blockchain_db.cpp:44
block_queue m_block_queue
Definition: cryptonote_protocol_handler.h:166
t_cryptonote_protocol_handler< t_core > cryptonote_protocol_handler
Definition: cryptonote_protocol_handler.h:80
Definition: cryptonote_protocol_defs.h:230
Definition: cryptonote_protocol_defs.h:322
Definition: cryptonote_protocol_handler.h:76
std::atomic< bool > m_stopping
Definition: cryptonote_protocol_handler.h:162
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:105
Definition: cryptonote_protocol_defs.h:172
bool post_notify(typename t_parameter::request &arg, cryptonote_connection_context &context)
Definition: cryptonote_protocol_handler.h:194
Definition: cryptonote_protocol_defs.h:272
Definition: cryptonote_protocol_defs.h:250
CORE_SYNC_DATA payload_type
Definition: cryptonote_protocol_handler.h:81
Definition: cryptonote_protocol_handler.h:61
std::atomic< bool > m_synchronized
Definition: cryptonote_protocol_handler.h:161
std::string blobdata
Definition: blobdatatype.h:39
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:358
void set_max_out_peers(unsigned int max)
Definition: cryptonote_protocol_handler.h:113
epee::math_helper::once_a_time_seconds< 43 > m_bad_peer_checker
Definition: cryptonote_protocol_handler.h:170
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT_PRE_V4
Definition: cryptonote_config.h:97
boost::posix_time::ptime m_period_start_time
Definition: cryptonote_protocol_handler.h:181
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:186
boost::mutex m_sync_lock
Definition: cryptonote_protocol_handler.h:165
int bool
Definition: stdbool.h:35
std::atomic< bool > m_ask_for_txpool_complement
Definition: cryptonote_protocol_handler.h:164
cryptonote_protocol_handler_base()
Definition: cryptonote_protocol_handler-base.cpp:94
relay_method
Methods tracking how a tx was received and relayed.
Definition: enums.h:36
DISABLE_VS_WARNINGS(4244 4345 4503) using namespace crypto
std::atomic< unsigned int > m_max_out_peers
Definition: cryptonote_protocol_handler.h:171
Definition: cryptonote_protocol_defs.h:213
Definition: cryptonote_protocol_defs.h:342
const char * name
Definition: simplewallet.cpp:417
epee::math_helper::once_a_time_milliseconds< 100 > m_standby_checker
Definition: cryptonote_protocol_handler.h:168
boost::posix_time::ptime m_sync_start_time
Definition: cryptonote_protocol_handler.h:180
size_t m_block_download_max_size
Definition: cryptonote_protocol_handler.h:176
uint64_t m_sync_start_height
Definition: cryptonote_protocol_handler.h:182
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:336
epee::math_helper::once_a_time_seconds< 8 > m_idle_peer_kicker
Definition: cryptonote_protocol_handler.h:167
uint64_t m_period_start_height
Definition: cryptonote_protocol_handler.h:183
Definition: cryptonote_protocol_handler_common.h:41
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:246