From 6b86ccc2f3307a0a1121f5b49e71ee6822de7dab Mon Sep 17 00:00:00 2001 From: Eric Frias Date: Tue, 24 Apr 2018 19:13:30 -0400 Subject: [PATCH] When tallying witness/committee member votes, always assign at least one vote to each witness/committee member for purposes of calculating their weight in the witness-account or committee-account authority. This will likely have no effect in a well established blockchain, but it does occur when a new blockchain is launched for testing without enough votes to fill all the witness/committee slots. --- libraries/chain/db_maint.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index eb2342c9..39fccf9c 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -228,7 +228,7 @@ void database::update_active_witnesses() { vote_counter vc; for( const witness_object& wit : wits ) - vc.add( wit.witness_account, _vote_tally_buffer[wit.vote_id] ); + vc.add( wit.witness_account, std::max(_vote_tally_buffer[wit.vote_id], UINT64_C(1)) ); vc.finish( a.active ); } } ); @@ -310,7 +310,7 @@ void database::update_active_committee_members() { vote_counter vc; for( const committee_member_object& cm : committee_members ) - vc.add( cm.committee_member_account, _vote_tally_buffer[cm.vote_id] ); + vc.add( cm.committee_member_account, std::max(_vote_tally_buffer[cm.vote_id], UINT64_C(1)) ); vc.finish( a.active ); } } );