Squashed commit of the following:
commita688bb93edAuthor: obucinac <obucinac@users.noreply.github.com> Date: Tue Feb 4 19:31:45 2020 +0100 son_wallet_object operations and multisig wallet recreation by RPC (#263) * Extend GPO.active_sons to contain votes and all public keys * Introduce son_wallet_object * son_wallet_object operations * Create son_wallet_object on new set of SONs, to initiate primary wallet recreation * son_wallet_object API and cli wallet commands * Send RPC command to bitcoin node to recreate multisig wallet * Updating wallet info through operation instead through database.modify() for persistance * Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp * Update libraries/chain/include/graphene/chain/protocol/son_wallet.hpp * Fix #include <graphene/chain/son_wallet_transfer_object.hpp> * Refactor primary wallet recreation * PW recreation refactoring, prevent duplicated recreations, update wallet address through proposal * Quickfix for checking payer in evaluator * Fix failing son_wallet_tests - Check for son_btc_account is temporarely disabled * Remove redundant file Co-authored-by: gladcow <jahr@yandex.ru> commit6e61d6b055Author: satyakoneru <satyakoneru.iiith@gmail.com> Date: Tue Feb 4 00:14:39 2020 +1100 SON233 - Provide correct downtime metrics to user (#278)
This commit is contained in:
parent
9db6179f79
commit
89ca9167d3
5 changed files with 21 additions and 5 deletions
|
|
@ -165,6 +165,20 @@ void database::pay_sons()
|
|||
}
|
||||
}
|
||||
|
||||
void database::update_son_metrics()
|
||||
{
|
||||
const auto& son_idx = get_index_type<son_index>().indices().get< by_id >();
|
||||
for( auto& son : son_idx )
|
||||
{
|
||||
auto& stats = son.statistics(*this);
|
||||
modify( stats, [&]( son_statistics_object& _stats)
|
||||
{
|
||||
_stats.total_downtime += _stats.current_interval_downtime;
|
||||
_stats.current_interval_downtime = 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void database::pay_workers( share_type& budget )
|
||||
{
|
||||
// ilog("Processing payroll! Available budget is ${b}", ("b", budget));
|
||||
|
|
@ -576,6 +590,8 @@ void database::update_active_sons()
|
|||
_sso.scheduler.update(active_sons);
|
||||
});
|
||||
|
||||
update_son_metrics();
|
||||
|
||||
if(gpo.active_sons.size() > 0 ) {
|
||||
if(gpo.parameters.get_son_btc_account_id() == GRAPHENE_NULL_ACCOUNT) {
|
||||
const auto& son_btc_account = create<account_object>( [&]( account_object& obj ) {
|
||||
|
|
|
|||
|
|
@ -548,6 +548,7 @@ namespace graphene { namespace chain {
|
|||
void perform_chain_maintenance(const signed_block& next_block, const global_property_object& global_props);
|
||||
void update_active_witnesses();
|
||||
void update_active_committee_members();
|
||||
void update_son_metrics();
|
||||
void update_active_sons();
|
||||
void update_worker_votes();
|
||||
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ object_id_type son_heartbeat_evaluator::do_apply(const son_heartbeat_operation&
|
|||
|
||||
void_result son_report_down_evaluator::do_evaluate(const son_report_down_operation& op)
|
||||
{ try {
|
||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK"); // can be removed after HF date pass
|
||||
FC_ASSERT(op.payer == db().get_global_properties().parameters.get_son_btc_account_id(), "Payer should be the son btc account");
|
||||
const auto& idx = db().get_index_type<son_index>().indices().get<by_id>();
|
||||
FC_ASSERT( idx.find(op.son_id) != idx.end() );
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ void_result recreate_son_wallet_evaluator::do_evaluate(const son_wallet_recreate
|
|||
|
||||
object_id_type recreate_son_wallet_evaluator::do_apply(const son_wallet_recreate_operation& op)
|
||||
{ try {
|
||||
FC_ASSERT(db().head_block_time() >= HARDFORK_SON_TIME, "Not allowed until SON HARDFORK");
|
||||
|
||||
const auto& idx = db().get_index_type<son_wallet_index>().indices().get<by_id>();
|
||||
auto itr = idx.rbegin();
|
||||
if(itr != idx.rend())
|
||||
|
|
|
|||
|
|
@ -8,9 +8,7 @@
|
|||
|
||||
#include <graphene/chain/proposal_object.hpp>
|
||||
#include <graphene/chain/sidechain_address_object.hpp>
|
||||
#include <graphene/chain/son_object.hpp>
|
||||
#include <graphene/chain/son_wallet_object.hpp>
|
||||
#include <graphene/chain/protocol/types.hpp>
|
||||
#include <graphene/peerplays_sidechain/sidechain_net_manager.hpp>
|
||||
#include <graphene/utilities/key_conversion.hpp>
|
||||
|
||||
|
|
@ -306,6 +304,7 @@ void peerplays_sidechain_plugin_impl::create_son_down_proposals()
|
|||
|
||||
chain::database& d = plugin.database();
|
||||
const chain::global_property_object& gpo = d.get_global_properties();
|
||||
const chain::dynamic_global_property_object& dgpo = d.get_dynamic_global_properties();
|
||||
const auto& idx = d.get_index_type<chain::son_index>().indices().get<by_id>();
|
||||
std::set<son_id_type> sons_being_reported_down = d.get_sons_being_reported_down();
|
||||
chain::son_id_type my_son_id = *(_sons.begin());
|
||||
|
|
@ -315,7 +314,8 @@ void peerplays_sidechain_plugin_impl::create_son_down_proposals()
|
|||
}
|
||||
auto son_obj = idx.find( son_inf.son_id );
|
||||
auto stats = son_obj->statistics(d);
|
||||
fc::time_point_sec last_active_ts = stats.last_active_timestamp;
|
||||
fc::time_point_sec last_maintenance_time = dgpo.next_maintenance_time - gpo.parameters.maintenance_interval;
|
||||
fc::time_point_sec last_active_ts = ((stats.last_active_timestamp > last_maintenance_time) ? stats.last_active_timestamp : last_maintenance_time);
|
||||
int64_t down_threshold = 2*180000000;
|
||||
if(son_obj->status == chain::son_status::active && (fc::time_point::now() - last_active_ts) > fc::microseconds(down_threshold)) {
|
||||
ilog("peerplays_sidechain_plugin: sending son down proposal for ${t} from ${s}",("t",std::string(object_id_type(son_obj->id)))("s",std::string(object_id_type(my_son_id))));
|
||||
|
|
|
|||
Loading…
Reference in a new issue