diff --git a/nano/node/active_transactions.cpp b/nano/node/active_transactions.cpp index de210bdd7a..09e52691c0 100644 --- a/nano/node/active_transactions.cpp +++ b/nano/node/active_transactions.cpp @@ -480,9 +480,10 @@ nano::election_insertion_result nano::active_transactions::insert (std::shared_p } // Validate a vote and apply it to the current election if one exists -nano::vote_code nano::active_transactions::vote (std::shared_ptr const & vote_a) +std::unordered_map nano::active_transactions::vote (std::shared_ptr const & vote_a) { nano::vote_code result{ nano::vote_code::indeterminate }; + // If all hashes were recently confirmed then it is a replay unsigned recently_confirmed_counter (0); @@ -642,10 +643,13 @@ bool nano::active_transactions::publish (std::shared_ptr const & bl lock.lock (); blocks.emplace (block_a->hash (), election); lock.unlock (); - if (auto const cache = node.vote_cache.find (block_a->hash ()); cache) + + auto cached = node.vote_cache.find (block_a->hash ()); + for (auto const & cached_vote : cached) { - cache->fill (election); + vote (cached_vote); } + node.stats.inc (nano::stat::type::active, nano::stat::detail::election_block_conflict); } } diff --git a/nano/node/active_transactions.hpp b/nano/node/active_transactions.hpp index d79d2b1bea..75afc9d75e 100644 --- a/nano/node/active_transactions.hpp +++ b/nano/node/active_transactions.hpp @@ -142,7 +142,7 @@ class active_transactions final */ nano::election_insertion_result insert (std::shared_ptr const &, nano::election_behavior = nano::election_behavior::normal); // Distinguishes replay votes, cannot be determined if the block is not in any election - nano::vote_code vote (std::shared_ptr const &); + std::unordered_map vote (std::shared_ptr const &); // Is the root of this block in the roots container bool active (nano::block const &) const; bool active (nano::qualified_root const &) const;