From 3aafd6cf551918acfa4003ad75b9541d299bc7c5 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Fri, 2 Oct 2015 15:39:10 -0400 Subject: [PATCH] HARDFORK 8/3/2015 - fix calculation for number of witnesses The new witness count calculation set a threshold equal to 50% of all stake rather than 50% of all stake that has voted for at least 2 witnesses. --- libraries/chain/db_maint.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index b88111ec..962aeec1 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -130,7 +130,11 @@ void database::pay_workers( share_type& budget ) void database::update_active_witnesses() { try { assert( _witness_count_histogram_buffer.size() > 0 ); - share_type stake_target = _total_voting_stake / 2; + share_type stake_target = (_total_voting_stake-_witness_count_histogram_buffer[0]) / 2; + +#warning HARDFORK - remove this code after Oct 2 testnet is over. + if( head_block_time() < fc::time_point_sec(1443900665) ) + stake_target = _total_voting_stake/2; /// 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) @@ -211,7 +215,13 @@ void database::update_active_witnesses() void database::update_active_committee_members() { try { assert( _committee_count_histogram_buffer.size() > 0 ); - uint64_t stake_target = _total_voting_stake / 2; + share_type stake_target = (_total_voting_stake-_witness_count_histogram_buffer[0]) / 2; + +#warning HARDFORK - remove this code after Oct 2 testnet is over. + if( head_block_time() < fc::time_point_sec(1443900665) ) + stake_target = _total_voting_stake/2; + + /// 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) uint64_t stake_tally = 0; // _committee_count_histogram_buffer[0];