diff --git a/plugins/net_plugin/include/eosio/net_plugin/net_plugin.hpp b/plugins/net_plugin/include/eosio/net_plugin/net_plugin.hpp index a2a0cf4357..b58cad4c72 100644 --- a/plugins/net_plugin/include/eosio/net_plugin/net_plugin.hpp +++ b/plugins/net_plugin/include/eosio/net_plugin/net_plugin.hpp @@ -18,6 +18,7 @@ namespace eosio { bool is_socket_open = false; bool is_blocks_only = false; bool is_transactions_only = false; + time_point last_vote_received; handshake_message last_handshake; }; @@ -99,4 +100,6 @@ namespace eosio { } -FC_REFLECT( eosio::connection_status, (peer)(remote_ip)(remote_port)(connecting)(syncing)(is_bp_peer)(is_socket_open)(is_blocks_only)(is_transactions_only)(last_handshake) ) +FC_REFLECT( eosio::connection_status, (peer)(remote_ip)(remote_port)(connecting)(syncing) + (is_bp_peer)(is_socket_open)(is_blocks_only)(is_transactions_only) + (last_vote_received)(last_handshake) ) diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index 980872043d..f6087e8059 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -956,6 +956,7 @@ namespace eosio { std::atomic consecutive_immediate_connection_close = 0; std::atomic is_bp_connection = false; block_status_monitor block_status_monitor_; + std::atomic last_vote_received; alignas(hardware_destructive_interference_sz) fc::mutex sync_response_expected_timer_mtx; @@ -1373,6 +1374,9 @@ namespace eosio { stat.syncing = peer_syncing_from_us; stat.is_bp_peer = is_bp_connection; stat.is_socket_open = socket_is_open(); + stat.is_blocks_only = is_blocks_only_connection(); + stat.is_transactions_only = is_transactions_only_connection(); + stat.last_vote_received = last_vote_received; fc::lock_guard g( conn_mtx ); stat.peer = peer_addr; stat.remote_ip = log_remote_endpoint_ip; @@ -1481,6 +1485,7 @@ namespace eosio { block_sync_send_start = 0ns; block_sync_frame_bytes_sent = 0; block_sync_throttling = false; + last_vote_received = time_point{}; if( reconnect && !shutdown ) { my_impl->connections.start_conn_timer( std::chrono::milliseconds( 100 ), @@ -3680,6 +3685,7 @@ namespace eosio { } void connection::handle_message( const vote_message_ptr& msg ) { + last_vote_received = fc::time_point::now(); if (vote_logger.is_enabled(fc::log_level::debug)) { peer_dlog(this, "received vote: block #${bn}:${id}.., ${v}, key ${k}..", ("bn", block_header::num_from_id(msg->block_id))("id", msg->block_id.str().substr(8,16))