diff --git a/plugins/net_plugin/include/eosio/net_plugin/protocol.hpp b/plugins/net_plugin/include/eosio/net_plugin/protocol.hpp index f4fb2c7561e..2f1032e2311 100644 --- a/plugins/net_plugin/include/eosio/net_plugin/protocol.hpp +++ b/plugins/net_plugin/include/eosio/net_plugin/protocol.hpp @@ -33,7 +33,7 @@ namespace eosio { chain_id_type chain_id; ///< used to identify chain fc::sha256 node_id; ///< used to identify peers and prevent self-connect chain::public_key_type key; ///< authentication key; may be a producer or peer key, or empty - tstamp time; + tstamp time{0}; fc::sha256 token; ///< digest of time to prove we own the private key of the key above chain::signature_type sig; ///< signature for the digest string p2p_address; @@ -43,7 +43,7 @@ namespace eosio { block_id_type head_id; string os; string agent; - int16_t generation; + int16_t generation{0}; }; @@ -81,16 +81,16 @@ namespace eosio { } struct go_away_message { - go_away_message (go_away_reason r = no_reason) : reason(r), node_id() {} - go_away_reason reason; + go_away_message(go_away_reason r = no_reason) : reason(r), node_id() {} + go_away_reason reason{no_reason}; fc::sha256 node_id; ///< for duplicate notification }; struct time_message { - tstamp org; //!< origin timestamp - tstamp rec; //!< receive timestamp - tstamp xmt; //!< transmit timestamp - mutable tstamp dst; //!< destination timestamp + tstamp org{0}; //!< origin timestamp + tstamp rec{0}; //!< receive timestamp + tstamp xmt{0}; //!< transmit timestamp + mutable tstamp dst{0}; //!< destination timestamp }; enum id_list_modes { @@ -112,9 +112,9 @@ namespace eosio { template struct select_ids { - select_ids () : mode(none),pending(0),ids() {} - id_list_modes mode; - uint32_t pending; + select_ids() : mode(none),pending(0),ids() {} + id_list_modes mode{none}; + uint32_t pending{0}; vector ids; bool empty () const { return (mode == none || ids.empty()); } }; @@ -123,20 +123,20 @@ namespace eosio { using ordered_blk_ids = select_ids; struct notice_message { - notice_message () : known_trx(), known_blocks() {} + notice_message() : known_trx(), known_blocks() {} ordered_txn_ids known_trx; ordered_blk_ids known_blocks; }; struct request_message { - request_message () : req_trx(), req_blocks() {} + request_message() : req_trx(), req_blocks() {} ordered_txn_ids req_trx; ordered_blk_ids req_blocks; }; struct sync_request_message { - uint32_t start_block; - uint32_t end_block; + uint32_t start_block{0}; + uint32_t end_block{0}; }; using net_message = static_variant connector_check; unique_ptr transaction_check; unique_ptr keepalive_timer; - boost::asio::steady_timer::duration connector_period; - boost::asio::steady_timer::duration txn_exp_period; - boost::asio::steady_timer::duration resp_expected_period; + boost::asio::steady_timer::duration connector_period{0}; + boost::asio::steady_timer::duration txn_exp_period{0}; + boost::asio::steady_timer::duration resp_expected_period{0}; boost::asio::steady_timer::duration keepalive_interval{std::chrono::seconds{32}}; int max_cleanup_time_ms = 0; @@ -349,7 +349,7 @@ namespace eosio { */ struct peer_block_state { block_id_type id; - uint32_t block_num; + uint32_t block_num{0}; }; typedef multi_index_container< @@ -362,7 +362,7 @@ namespace eosio { struct update_block_num { - uint32_t new_bnum; + uint32_t new_bnum{0}; update_block_num(uint32_t bnum) : new_bnum(bnum) {} void operator() (node_transaction_state& nts) { nts.block_num = new_bnum; @@ -380,9 +380,9 @@ namespace eosio { :start_block( start ), end_block( end ), last( last_acted ), start_time(time_point::now()) {} - uint32_t start_block; - uint32_t end_block; - uint32_t last; ///< last sent or received + uint32_t start_block{0}; + uint32_t end_block{0}; + uint32_t last{0}; ///< last sent or received time_point start_time; ///< time request made or received }; @@ -530,7 +530,7 @@ namespace eosio { double offset{0}; //!< peer offset static const size_t ts_buffer_size{32}; - char ts[ts_buffer_size]; //!< working buffer for making human readable timestamps + char ts[ts_buffer_size]{}; //!< working buffer for making human readable timestamps /** @} */ bool connected(); @@ -661,12 +661,12 @@ namespace eosio { in_sync }; - uint32_t sync_known_lib_num; - uint32_t sync_last_requested_num; - uint32_t sync_next_expected_num; - uint32_t sync_req_span; + uint32_t sync_known_lib_num{0}; + uint32_t sync_last_requested_num{0}; + uint32_t sync_next_expected_num{0}; + uint32_t sync_req_span{0}; connection_ptr source; - stages state; + stages state{in_sync}; chain_plugin* chain_plug = nullptr;