Skip to content

Vote timestamp encapsulation#3544

Merged
clemahieu merged 5 commits intodevelopfrom
vote_timestamp_encapsulation
Nov 5, 2021
Merged

Vote timestamp encapsulation#3544
clemahieu merged 5 commits intodevelopfrom
vote_timestamp_encapsulation

Conversation

@clemahieu
Copy link
Copy Markdown
Contributor

This is the first commit related to #3453

It encapsulates the nano::vote::timestamp field and rewrites tests to use the encapsulated field.

…mp field. The only functional change is that each vote is now its own object rather than modifying an existing one.
…thing that's already tested above, signature correctness with respect to vote contents.
boost::transform_iterator<nano::iterate_vote_blocks_as_hash, nano::vote_blocks_vec_iter> end () const;
std::string to_json () const;
uint64_t timestamp () const;
static uint64_t constexpr timestamp_max = { 0xffff'ffff'ffff'ffffULL };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be maybe any better to use the numeric limits?

Also, on a different note, is timestamp_m (the suffix _m) for member? I don't remember seeing it a lot.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This number will be different with the actual vote duration changes.

tree.put ("signature", signature.number ());
tree.put ("sequence", std::to_string (timestamp));
tree.put ("timestamp", std::to_string (timestamp));
tree.put ("sequence", std::to_string (timestamp ()));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we writing both a sequence and a timestamp?
For backwards compatibility?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes though we could probably remove sequence at this point.

@clemahieu clemahieu merged commit 8ab08a1 into develop Nov 5, 2021
@clemahieu clemahieu deleted the vote_timestamp_encapsulation branch November 5, 2021 15:22
@zhyatt zhyatt added the functionality quality improvements This item indicates the need for or supplies a better way to implement existing functionality label Nov 5, 2021
@zhyatt zhyatt added this to the V23.0 milestone Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functionality quality improvements This item indicates the need for or supplies a better way to implement existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants