Skip to content

Commit

Permalink
Fix missing channel source
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Apr 5, 2024
1 parent 32d7160 commit dcf214c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
12 changes: 5 additions & 7 deletions nano/node/vote_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@ nano::vote_processor::vote_processor (nano::active_transactions & active_a, nano
rep_crawler{ rep_crawler_a },
ledger{ ledger_a },
network_params{ network_params_a },
rep_tiers{ rep_tiers_a },
max_votes{ flags_a.vote_processor_capacity }
rep_tiers{ rep_tiers_a }
{
queue.max_size_query = [this] (auto const & origin) {
switch (origin.source)
{
case nano::rep_tier::tier_3:
case nano::rep_tier::tier_2:
case nano::rep_tier::tier_1:
return 512;
return 256;
case nano::rep_tier::none:
return 32;
}
Expand Down Expand Up @@ -96,7 +95,7 @@ bool nano::vote_processor::vote (std::shared_ptr<nano::vote> const & vote, std::
bool added = false;
{
nano::lock_guard<nano::mutex> guard{ mutex };
added = queue.push ({ vote, channel }, tier);
added = queue.push (vote, { tier, channel });
}
if (added)
{
Expand Down Expand Up @@ -147,10 +146,9 @@ void nano::vote_processor::run_batch (nano::unique_lock<nano::mutex> & lock)

lock.unlock ();

for (auto const & [entry, origin] : batch)
for (auto const & [vote, origin] : batch)
{
auto const & [vote, channel] = entry;
vote_blocking (vote, channel);
vote_blocking (vote, origin.channel);
}

total_processed += batch.size ();
Expand Down
5 changes: 1 addition & 4 deletions nano/node/vote_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ class vote_processor final
void run_batch (nano::unique_lock<nano::mutex> &);

private:
std::size_t const max_votes;

using entry_t = std::pair<std::shared_ptr<nano::vote>, std::shared_ptr<nano::transport::channel>>;
nano::fair_queue<entry_t, nano::rep_tier> queue;
nano::fair_queue<std::shared_ptr<nano::vote>, nano::rep_tier> queue;

private:
bool stopped{ false };
Expand Down

0 comments on commit dcf214c

Please sign in to comment.