vote.is_final() helper

This commit is contained in:
Piotr Wójcik 2024-03-15 19:24:56 +01:00
commit 41c83a77e1
2 changed files with 6 additions and 0 deletions

View file

@ -137,6 +137,11 @@ std::chrono::milliseconds nano::vote::duration () const
return std::chrono::milliseconds{ 1u << (duration_bits () + 4) }; return std::chrono::milliseconds{ 1u << (duration_bits () + 4) };
} }
bool nano::vote::is_final () const
{
return is_final_timestamp (timestamp_m);
}
void nano::vote::serialize_json (boost::property_tree::ptree & tree) const void nano::vote::serialize_json (boost::property_tree::ptree & tree) const
{ {
tree.put ("account", account.to_account ()); tree.put ("account", account.to_account ());

View file

@ -47,6 +47,7 @@ public:
uint64_t timestamp () const; uint64_t timestamp () const;
uint8_t duration_bits () const; uint8_t duration_bits () const;
std::chrono::milliseconds duration () const; std::chrono::milliseconds duration () const;
bool is_final () const;
static uint64_t constexpr timestamp_mask = { 0xffff'ffff'ffff'fff0ULL }; static uint64_t constexpr timestamp_mask = { 0xffff'ffff'ffff'fff0ULL };
static nano::seconds_t constexpr timestamp_max = { 0xffff'ffff'ffff'fff0ULL }; static nano::seconds_t constexpr timestamp_max = { 0xffff'ffff'ffff'fff0ULL };