diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index 67601c2e..9ce436a7 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -700,7 +700,12 @@ void database::_apply_block( const signed_block& next_block ) if (global_props.parameters.witness_schedule_algorithm == GRAPHENE_WITNESS_SCHEDULED_ALGORITHM) { update_witness_schedule(next_block); - if(global_props.active_sons.size() > 0) { + bool need_to_update_son_schedule = false; + for(const auto& active_sons : global_props.active_sons){ + if(!active_sons.second.empty()) + need_to_update_son_schedule = true; + } + if(need_to_update_son_schedule) { update_son_schedule(next_block); } } diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index cc2687e2..632415ce 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -874,10 +874,10 @@ void database::update_active_sons() }); _sso.scheduler.update(active_sons); // similar to witness, produce schedule for sons - if(cur_active_sons.size() == 0 && new_active_sons.size() > 0) + if(cur_active_sons.at(sidechain_type::bitcoin).size() == 0 && new_active_sons.at(sidechain_type::bitcoin).size() > 0) { witness_scheduler_rng rng(_sso.rng_seed.begin(), GRAPHENE_NEAR_SCHEDULE_CTR_IV); - for( size_t i=0; i 0) + if(cur_active_sons.at(sidechain_type::hive).size() == 0 && new_active_sons.at(sidechain_type::hive).size() > 0) { witness_scheduler_rng rng(_sso.rng_seed.begin(), GRAPHENE_NEAR_SCHEDULE_CTR_IV); - for( size_t i=0; i 0) + if(cur_active_sons.at(sidechain_type::bitcoin).size() == 0 && new_active_sons.at(sidechain_type::bitcoin).size() > 0) { witness_scheduler_rng rng(_sso.rng_seed.begin(), GRAPHENE_NEAR_SCHEDULE_CTR_IV); - for( size_t i=0; i active_committee_members; // updated once per maintenance interval flat_set active_witnesses; // updated once per maintenance interval - flat_map > active_sons; // updated once per maintenance interval + + //! Fixme - delete sidechain type from here + flat_map > active_sons = []() // updated once per maintenance interval + { + flat_map > active_sons; + active_sons[sidechain_type::bitcoin] = vector(); + active_sons[sidechain_type::hive] = vector(); + return active_sons; + }(); // n.b. witness scheduling is done by witness_schedule object };