diff --git a/plugins/net_plugin/include/eosio/net_plugin/auto_bp_peering.hpp b/plugins/net_plugin/include/eosio/net_plugin/auto_bp_peering.hpp index a44fb51112..87772eb817 100644 --- a/plugins/net_plugin/include/eosio/net_plugin/auto_bp_peering.hpp +++ b/plugins/net_plugin/include/eosio/net_plugin/auto_bp_peering.hpp @@ -100,6 +100,11 @@ class bp_connection_manager { config.my_bp_accounts.insert(accounts.begin(), accounts.end()); } + // thread safe, my_bp_accounts only modified during plugin startup + bool is_producer(account_name account) const { + return config.my_bp_accounts.count(account) != 0; + } + // Only called at plugin startup void set_bp_peers(const std::vector& peers) { try { diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index ed4c9992c9..55051e0853 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -2757,13 +2757,15 @@ namespace eosio { if (cp->protocol_version >= proto_block_nack) { if (cp->consecutive_blocks_nacks > connection::consecutive_block_nacks_threshold) { - auto send_buffer = block_id_buff_factory.get_send_buffer( block_notice_message{id} ); - boost::asio::post(cp->strand, [cp, send_buffer{std::move(send_buffer)}, bnum]() { - cp->latest_blk_time = std::chrono::steady_clock::now(); - peer_dlog( cp, "bcast block_notice ${b}", ("b", bnum) ); - cp->enqueue_buffer( msg_type_t::block_notice_message, false, send_buffer, 0, no_reason ); - }); - return; + if (!my_impl->is_producer(b->producer)) { // always broadcast our produced blocks + auto send_buffer = block_id_buff_factory.get_send_buffer( block_notice_message{id} ); + boost::asio::post(cp->strand, [cp, send_buffer{std::move(send_buffer)}, bnum]() { + cp->latest_blk_time = std::chrono::steady_clock::now(); + peer_dlog( cp, "bcast block_notice ${b}", ("b", bnum) ); + cp->enqueue_buffer( msg_type_t::block_notice_message, false, send_buffer, 0, no_reason ); + }); + return; + } } }