Save the correct state of witness scheduler
Instead of reconstructing random save that field to database
This commit is contained in:
parent
da129f5bb8
commit
372c2bce0f
2 changed files with 1 additions and 15 deletions
|
|
@ -225,21 +225,6 @@ void database::open(
|
||||||
_p_chain_property_obj = &get( chain_property_id_type() );
|
_p_chain_property_obj = &get( chain_property_id_type() );
|
||||||
_p_dyn_global_prop_obj = &get( dynamic_global_property_id_type() );
|
_p_dyn_global_prop_obj = &get( dynamic_global_property_id_type() );
|
||||||
_p_witness_schedule_obj = &get( witness_schedule_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();
|
fc::optional<block_id_type> last_block = _block_id_to_block.last_id();
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,7 @@ namespace graphene { namespace chain {
|
||||||
}}
|
}}
|
||||||
|
|
||||||
FC_REFLECT_DERIVED( graphene::chain::dynamic_global_property_object, (graphene::db::object),
|
FC_REFLECT_DERIVED( graphene::chain::dynamic_global_property_object, (graphene::db::object),
|
||||||
|
(random)
|
||||||
(head_block_number)
|
(head_block_number)
|
||||||
(head_block_id)
|
(head_block_id)
|
||||||
(time)
|
(time)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue