Fixed committee member update issue
This commit is contained in:
parent
ee14f4db96
commit
39a6c895b9
2 changed files with 24 additions and 3 deletions
|
|
@ -253,7 +253,13 @@ void database::update_active_witnesses()
|
|||
void database::update_active_committee_members()
|
||||
{ try {
|
||||
assert( _committee_count_histogram_buffer.size() > 0 );
|
||||
share_type stake_target = (_total_voting_stake-_witness_count_histogram_buffer[0]) / 2;
|
||||
share_type stake_target = (_total_voting_stake-_committee_count_histogram_buffer[0]) / 2;
|
||||
share_type old_stake_target = (_total_voting_stake-_witness_count_histogram_buffer[0]) / 2;
|
||||
// TODO
|
||||
// all the stuff about old_stake_target can *hopefully* be removed after the
|
||||
// hardfork date has passed
|
||||
if( stake_target != old_stake_target )
|
||||
ilog( "Different stake targets: ${old} / ${new}", ("old",old_stake_target)("new",stake_target) );
|
||||
|
||||
/// accounts that vote for 0 or 1 witness do not get to express an opinion on
|
||||
/// the number of witnesses to have (they abstain and are non-voting accounts)
|
||||
|
|
@ -264,6 +270,20 @@ void database::update_active_committee_members()
|
|||
&& (stake_tally <= stake_target) )
|
||||
stake_tally += _committee_count_histogram_buffer[++committee_member_count];
|
||||
|
||||
if( stake_target != old_stake_target && old_stake_target > 0 && head_block_time() < fc::time_point_sec(HARDFORK_1002_TIME) )
|
||||
{
|
||||
uint64_t old_stake_tally = 0;
|
||||
size_t old_committee_member_count = 0;
|
||||
while( (old_committee_member_count < _committee_count_histogram_buffer.size() - 1)
|
||||
&& (old_stake_tally <= old_stake_target) )
|
||||
old_stake_tally += _committee_count_histogram_buffer[++old_committee_member_count];
|
||||
if( old_committee_member_count != committee_member_count )
|
||||
{
|
||||
ilog( "Committee member count mismatch ${old} / ${new}", ("old",old_committee_member_count)("new", committee_member_count) );
|
||||
committee_member_count = old_committee_member_count;
|
||||
}
|
||||
}
|
||||
|
||||
const chain_property_object& cpo = get_chain_properties();
|
||||
auto committee_members = sort_votable_objects<committee_member_index>(std::max(committee_member_count*2+1, (size_t)cpo.immutable_parameters.min_committee_member_count));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// added transaction size check
|
||||
// Bug fix of update commitee member update
|
||||
#ifndef HARDFORK_1002_TIME
|
||||
#define HARDFORK_1002_TIME (fc::time_point_sec( 1566797400 )) //Monday, 26 August 2019 05:30:00 GMT
|
||||
#endif
|
||||
#define HARDFORK_1002_TIME (fc::time_point_sec( 1566893013 )) //Tuesday, 27 August 2019 08:03:33 GMT
|
||||
#endif
|
||||
Loading…
Reference in a new issue