Skip to content

Commit

Permalink
Remove non final replies
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed May 26, 2024
1 parent 126f29c commit 51daa39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
1 change: 1 addition & 0 deletions nano/lib/stats_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ enum class detail
requests_generated_votes,
requests_cannot_vote,
requests_unknown,
requests_non_final,

// request_aggregator
request_hashes,
Expand Down
20 changes: 2 additions & 18 deletions nano/node/request_aggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,22 +222,13 @@ auto nano::request_aggregator::aggregate (nano::secure::transaction const & tran
// Allow same root vote
if (block != nullptr && final_vote_hashes.size () > 1)
{
// WTF? This shouldn't be done like this
to_generate_final.push_back (block);
block = ledger.any.block_get (transaction, final_vote_hashes[1]);
debug_assert (final_vote_hashes.size () == 2);
}
}

// 3. Election winner by hash
if (block == nullptr)
{
auto election = vote_router.election (hash);
if (election != nullptr)
{
block = election->winner ();
}
}

// 4. Ledger by hash
if (block == nullptr)
{
Expand Down Expand Up @@ -280,14 +271,7 @@ auto nano::request_aggregator::aggregate (nano::secure::transaction const & tran
}
else
{
to_generate.push_back (block);
}

// Let the node know about the alternative block
if (block->hash () != hash)
{
nano::publish publish (network_constants, block);
channel_a->send (publish);
stats.inc (nano::stat::type::requests, nano::stat::detail::requests_non_final, stat::dir::in);
}
}
else
Expand Down

0 comments on commit 51daa39

Please sign in to comment.