From d8371cf7280edc4536def083507d4ad108572928 Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Wed, 1 Nov 2023 16:44:36 +0000 Subject: [PATCH] Rename nano::vote_spacing to nano::voting::spacing --- nano/core_test/voting.cpp | 4 ++-- nano/node/voting/generator.hpp | 2 +- nano/node/voting/spacing.cpp | 8 ++++---- nano/node/voting/spacing.hpp | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nano/core_test/voting.cpp b/nano/core_test/voting.cpp index 8ff85771d0..1b8dc6c043 100644 --- a/nano/core_test/voting.cpp +++ b/nano/core_test/voting.cpp @@ -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 }; @@ -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 }; diff --git a/nano/node/voting/generator.hpp b/nano/node/voting/generator.hpp index d722f94818..e5546d6a71 100644 --- a/nano/node/voting/generator.hpp +++ b/nano/node/voting/generator.hpp @@ -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; diff --git a/nano/node/voting/spacing.cpp b/nano/node/voting/spacing.cpp index de44e528a1..c98d1de69e 100644 --- a/nano/node/voting/spacing.cpp +++ b/nano/node/voting/spacing.cpp @@ -1,11 +1,11 @@ #include -void nano::vote_spacing::trim () +void nano::voting::spacing::trim () { recent.get ().erase (recent.get ().begin (), recent.get ().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 ().equal_range (root_a); result && range.first != range.second; ++range.first) @@ -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 (); @@ -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 (); } diff --git a/nano/node/voting/spacing.hpp b/nano/node/voting/spacing.hpp index 5895bd1a2f..86a44237e3 100644 --- a/nano/node/voting/spacing.hpp +++ b/nano/node/voting/spacing.hpp @@ -12,9 +12,9 @@ namespace mi = boost::multi_index; -namespace nano +namespace nano::voting { -class vote_spacing final +class spacing final { class entry { @@ -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 } { }