Skip to content

Commit

Permalink
GH-1091 Handle repeated block_notice with request for blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Jan 6, 2025
1 parent 167ecb4 commit 5094f92
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,7 @@ namespace eosio {
static constexpr uint16_t consecutive_block_nacks_threshold{3}; // stop sending blocks when reached
uint16_t consecutive_blocks_nacks{0};
block_id_type last_block_nack;
block_id_type last_block_notice;

connection_status get_status()const;

Expand Down Expand Up @@ -3793,6 +3794,15 @@ namespace eosio {
latest_blk_time = std::chrono::steady_clock::now();
if (my_impl->dispatcher.have_block(msg.id)) {
my_impl->dispatcher.add_peer_block(msg.id, connection_id);
} else {
if (block_header::num_from_id(last_block_notice) == block_header::num_from_id(msg.id) - 1) {
send_block_nack({});
request_message req;
req.req_blocks.mode = normal;
req.req_blocks.ids.push_back(last_block_notice);
enqueue( req );
}
last_block_notice = msg.id;
}
}

Expand Down

0 comments on commit 5094f92

Please sign in to comment.