From 51420475d0ea6359e19db09a4f8205406d54d398 Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Fri, 17 May 2024 14:22:03 +0100 Subject: [PATCH] Use deque rather than vector for vote_cache::top results. --- nano/node/vote_cache.cpp | 4 ++-- nano/node/vote_cache.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nano/node/vote_cache.cpp b/nano/node/vote_cache.cpp index 3f41d4da10..654e4bdd5c 100644 --- a/nano/node/vote_cache.cpp +++ b/nano/node/vote_cache.cpp @@ -231,11 +231,11 @@ void nano::vote_cache::clear () cache.clear (); } -std::vector nano::vote_cache::top (const nano::uint128_t & min_tally) +std::deque nano::vote_cache::top (const nano::uint128_t & min_tally) { stats.inc (nano::stat::type::vote_cache, nano::stat::detail::top); - std::vector results; + std::deque results; { nano::lock_guard lock{ mutex }; diff --git a/nano/node/vote_cache.hpp b/nano/node/vote_cache.hpp index dbd50eaa2c..4b267ed18d 100644 --- a/nano/node/vote_cache.hpp +++ b/nano/node/vote_cache.hpp @@ -145,7 +145,7 @@ class vote_cache final * The blocks are sorted in descending order by final tally, then by tally * @param min_tally minimum tally threshold, entries below with their voting weight below this will be ignored */ - std::vector top (nano::uint128_t const & min_tally); + std::deque top (nano::uint128_t const & min_tally); public: // Container info std::unique_ptr collect_container_info (std::string const & name) const;