Fix for scheduler wrong state #700

Closed
hirunda wants to merge 3 commits from bug/378/fix_for_restarting_node_without_replay_option into develop
Showing only changes of commit 95b03d30c1 - Show all commits

View file

@ -225,6 +225,21 @@ void database::open(
_p_chain_property_obj = &get( chain_property_id_type() );
_p_dyn_global_prop_obj = &get( dynamic_global_property_id_type() );
_p_witness_schedule_obj = &get( witness_schedule_id_type() );
// Update 'random' from dynamic global property object to the state
// before shutdown happened. Since scheduler seeds depands on the
// right state of random dynamic global property
for (uint32_t i = 1; i <= head_block_num(); i++) {
// dynamic global properties updating
modify(*_p_dyn_global_prop_obj, [this, i](dynamic_global_property_object &dgp) {
secret_hash_type::encoder enc;
fc::raw::pack(enc, dgp.random);
const auto &block = fetch_block_by_number(i);
fc::raw::pack(enc, block->previous_secret);
dgp.random = enc.result();
});
}
}
fc::optional<block_id_type> last_block = _block_id_to_block.last_id();