-
Notifications
You must be signed in to change notification settings - Fork 648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add last_vote_time to account stats object #1449
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with Ubuntu 18.10 / Boost 1.67. Good coverge on Boost test. Thanks!
db.modify(stats_obj, [&](account_statistics_object &obj) { | ||
obj.last_vote_time = db.head_block_time(); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means every time when do_evaluate
is called (E.G. by validate_transaction
API ?), the data will be updated. But do_evaluate
can fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually as an unwritten principle we don't modify database in do_evaluate
, but probably it's practically fine to do so. @pmconrad your opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that do_evaluate
must not modify the database.
IMO it's a good design decision to separate the various stages of operation evaluation, and we should stick with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, thanks. ill refactor to do the update in do_apply
or something different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to bump GRAPHENE_CURRENT_DB_VERSION
when adding a field
tests/tests/voting_tests.cpp
Outdated
// last_vote_time is not updated | ||
now = db.head_block_time().sec_since_epoch(); | ||
alice_stats_obj = db.get_account_stats_by_owner(alice_id); | ||
BOOST_CHECK(alice_stats_obj.last_vote_time.sec_since_epoch() != now); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better check that last_vote_time
equals the previous now
Looks like you have to rebase to avoid the conflict |
fixed conflict in database bump number, need to re approve. thanks. |
Pull for #1393
I am not very sure about the default value of
account
parameter: https://github.com/oxarbitrage/bitshares-core/blob/5d1c15cdd7faa955463902ea1348ba302eb65681/libraries/chain/account_evaluator.cpp#L60I did it that way so i can call
verify_account_votes
without the extra parameter at account creation: https://github.com/oxarbitrage/bitshares-core/blob/5d1c15cdd7faa955463902ea1348ba302eb65681/libraries/chain/account_evaluator.cpp#L162Open to suggestions.