Skip to content

Commit

Permalink
GH-3 Do not clear num_messages if there are votes in the index to be …
Browse files Browse the repository at this point in the history
…processed
  • Loading branch information
heifner committed Apr 18, 2024
1 parent b694aad commit 344b778
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions libraries/chain/include/eosio/chain/vote_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,10 @@ class vote_processor_t {
if (stopped)
return;
auto num_queued_votes = --queued_votes;
bool reset_num_messages = num_queued_votes == 0; // caught up, so clear num_messages
if (block_header::num_from_id(msg->block_id) <= lib.load(std::memory_order_relaxed))
return; // ignore any votes lower than lib
std::unique_lock g(mtx);
if (reset_num_messages)
if (num_queued_votes == 0 && index.empty()) // caught up, clear num_messages
num_messages.clear();
if (auto& num_msgs = ++num_messages[connection_id]; num_msgs > max_votes_per_connection) {
remove_connection(connection_id);
Expand Down

0 comments on commit 344b778

Please sign in to comment.