-
Notifications
You must be signed in to change notification settings - Fork 18
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
BLOCKBACK- 174 Roll in GPOS votes from 6th sub-period #202
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,7 @@ struct gpos_fixture: database_fixture | |
op.account = account_id; | ||
op.new_options = account_id(db).options; | ||
op.new_options->votes.insert(vote_for); | ||
op.extensions.value.update_last_voting_time = true; | ||
trx.operations.push_back(op); | ||
set_expiration(db, trx); | ||
trx.validate(); | ||
|
@@ -640,18 +641,23 @@ BOOST_AUTO_TEST_CASE( voting ) | |
BOOST_CHECK_EQUAL(db.get_global_properties().parameters.gpos_period_start(), now.sec_since_epoch()); | ||
|
||
advance_x_maint(5); | ||
// a new GPOS period is in but vote from user is before the start so his voting power is 0 | ||
// a new GPOS period is in but vote from user is before the start. WHo ever votes in 6th sub-period, votes will carry | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated |
||
now = db.head_block_time(); | ||
BOOST_CHECK_EQUAL(db.get_global_properties().parameters.gpos_period_start(), now.sec_since_epoch()); | ||
|
||
generate_block(); | ||
|
||
// we are in the second GPOS period, at subperiod 1, | ||
witness1 = witness_id_type(1)(db); | ||
witness2 = witness_id_type(2)(db); | ||
BOOST_CHECK_EQUAL(witness1.total_votes, 0); | ||
BOOST_CHECK_EQUAL(witness2.total_votes, 0); | ||
//It's critical here, since bob votes in 6th sub-period of last vesting period, witness2 should retain his votes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For clarity. Can you add some comment in the place where bob is voting in the 6th period ? I cant find where this is happening. Thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added for all sub-periods |
||
BOOST_CHECK_EQUAL(witness2.total_votes, 100); | ||
|
||
|
||
// we are in the second GPOS period, at subperiod 2, lets vote here | ||
// lets vote here from alice to generate votes for witness 1 | ||
//vote from bob to reatin VF 1 | ||
vote_for(alice_id, witness1.vote_id, alice_private_key); | ||
vote_for(bob_id, witness2.vote_id, bob_private_key); | ||
generate_block(); | ||
|
||
|
@@ -661,15 +667,15 @@ BOOST_AUTO_TEST_CASE( voting ) | |
witness1 = witness_id_type(1)(db); | ||
witness2 = witness_id_type(2)(db); | ||
|
||
BOOST_CHECK_EQUAL(witness1.total_votes, 0); | ||
BOOST_CHECK_EQUAL(witness1.total_votes, 100); | ||
BOOST_CHECK_EQUAL(witness2.total_votes, 100); | ||
|
||
advance_x_maint(10); | ||
|
||
witness1 = witness_id_type(1)(db); | ||
witness2 = witness_id_type(2)(db); | ||
|
||
BOOST_CHECK_EQUAL(witness1.total_votes, 0); | ||
BOOST_CHECK_EQUAL(witness1.total_votes, 83); | ||
BOOST_CHECK_EQUAL(witness2.total_votes, 83); | ||
|
||
vote_for(bob_id, witness2.vote_id, bob_private_key); | ||
|
@@ -680,7 +686,7 @@ BOOST_AUTO_TEST_CASE( voting ) | |
witness1 = witness_id_type(1)(db); | ||
witness2 = witness_id_type(2)(db); | ||
|
||
BOOST_CHECK_EQUAL(witness1.total_votes, 0); | ||
BOOST_CHECK_EQUAL(witness1.total_votes, 66); | ||
BOOST_CHECK_EQUAL(witness2.total_votes, 83); | ||
|
||
// alice votes again, now for witness 2, her vote worth 100 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.
Comment is redundant
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.
removed