From 4b64b1f2252c32770f8389e5e739070041fb0360 Mon Sep 17 00:00:00 2001 From: satyakoneru Date: Mon, 27 Jan 2020 14:27:14 +0000 Subject: [PATCH] SON206_Plugin_CrashFix_Reorg - add owner auths to consensus account --- libraries/chain/db_maint.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index a0f16d60..5d973a09 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -566,9 +566,14 @@ void database::update_active_sons() // Ensure that everyone has at least one vote. Zero weights aren't allowed. const son_object& son = get(son_info.son_id); uint16_t votes = std::max((_vote_tally_buffer[son.vote_id] >> bits_to_drop), uint64_t(1) ); + obj.owner.account_auths[son.son_account] += votes; + obj.owner.weight_threshold += votes; obj.active.account_auths[son.son_account] += votes; obj.active.weight_threshold += votes; } + obj.owner.weight_threshold *= 2; + obj.owner.weight_threshold /= 3; + obj.owner.weight_threshold += 1; obj.active.weight_threshold *= 2; obj.active.weight_threshold /= 3; obj.active.weight_threshold += 1; @@ -583,6 +588,8 @@ void database::update_active_sons() modify( get(gpo.parameters.get_son_btc_account_id()), [&]( account_object& obj ) { uint64_t total_votes = 0; + obj.owner.weight_threshold = 0; + obj.owner.account_auths.clear(); obj.active.weight_threshold = 0; obj.active.account_auths.clear(); for( const auto& son_info : gpo.active_sons ) @@ -598,9 +605,14 @@ void database::update_active_sons() // Ensure that everyone has at least one vote. Zero weights aren't allowed. const son_object& son = get(son_info.son_id); uint16_t votes = std::max((_vote_tally_buffer[son.vote_id] >> bits_to_drop), uint64_t(1) ); + obj.owner.account_auths[son.son_account] += votes; + obj.owner.weight_threshold += votes; obj.active.account_auths[son.son_account] += votes; obj.active.weight_threshold += votes; } + obj.owner.weight_threshold *= 2; + obj.owner.weight_threshold /= 3; + obj.owner.weight_threshold += 1; obj.active.weight_threshold *= 2; obj.active.weight_threshold /= 3; obj.active.weight_threshold += 1;