Skip to content

Commit

Permalink
Rename nano::vote_spacing to nano::voting::spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu committed Nov 1, 2023
1 parent df2d664 commit d8371cf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions nano/core_test/voting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ TEST (vote_generator, multiple_representatives)

TEST (vote_spacing, basic)
{
nano::vote_spacing spacing{ std::chrono::milliseconds{ 100 } };
nano::voting::spacing spacing{ std::chrono::milliseconds{ 100 } };
nano::root root1{ 1 };
nano::root root2{ 2 };
nano::block_hash hash3{ 3 };
Expand All @@ -124,7 +124,7 @@ TEST (vote_spacing, basic)
TEST (vote_spacing, prune)
{
auto length = std::chrono::milliseconds{ 100 };
nano::vote_spacing spacing{ length };
nano::voting::spacing spacing{ length };
nano::root root1{ 1 };
nano::root root2{ 2 };
nano::block_hash hash3{ 3 };
Expand Down
2 changes: 1 addition & 1 deletion nano/node/voting/generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class generator final
nano::wallets & wallets;
nano::voting::processor & vote_processor;
nano::voting::history & history;
nano::vote_spacing spacing;
nano::voting::spacing spacing;
nano::network & network;
nano::stats & stats;

Expand Down
8 changes: 4 additions & 4 deletions nano/node/voting/spacing.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <nano/node/voting/spacing.hpp>

void nano::vote_spacing::trim ()
void nano::voting::spacing::trim ()
{
recent.get<tag_time> ().erase (recent.get<tag_time> ().begin (), recent.get<tag_time> ().upper_bound (std::chrono::steady_clock::now () - delay));
}

bool nano::vote_spacing::votable (nano::root const & root_a, nano::block_hash const & hash_a) const
bool nano::voting::spacing::votable (nano::root const & root_a, nano::block_hash const & hash_a) const
{
bool result = true;
for (auto range = recent.get<tag_root> ().equal_range (root_a); result && range.first != range.second; ++range.first)
Expand All @@ -16,7 +16,7 @@ bool nano::vote_spacing::votable (nano::root const & root_a, nano::block_hash co
return result;
}

void nano::vote_spacing::flag (nano::root const & root_a, nano::block_hash const & hash_a)
void nano::voting::spacing::flag (nano::root const & root_a, nano::block_hash const & hash_a)
{
trim ();
auto now = std::chrono::steady_clock::now ();
Expand All @@ -33,7 +33,7 @@ void nano::vote_spacing::flag (nano::root const & root_a, nano::block_hash const
}
}

std::size_t nano::vote_spacing::size () const
std::size_t nano::voting::spacing::size () const
{
return recent.size ();
}
6 changes: 3 additions & 3 deletions nano/node/voting/spacing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

namespace mi = boost::multi_index;

namespace nano
namespace nano::voting
{
class vote_spacing final
class spacing final
{
class entry
{
Expand All @@ -35,7 +35,7 @@ class vote_spacing final
void trim ();

public:
vote_spacing (std::chrono::milliseconds const & delay) :
spacing (std::chrono::milliseconds const & delay) :
delay{ delay }
{
}
Expand Down

0 comments on commit d8371cf

Please sign in to comment.