diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index 2cf8e9d1..99131146 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -557,13 +557,18 @@ const witness_object& database::validate_block_header( uint32_t skip, const sign const witness_object& witness = next_block.witness(*this); FC_ASSERT( secret_hash_type::hash( next_block.previous_secret ) == witness.next_secret_hash, "", ("previous_secret", next_block.previous_secret)("next_secret_hash", witness.next_secret_hash)); - if( !(skip&skip_witness_signature) ) FC_ASSERT( next_block.validate_signee( witness.signing_key ) ); - uint32_t slot_num = get_slot_at_time( next_block.timestamp ); - FC_ASSERT( slot_num > 0 ); + if( !(skip&skip_witness_signature) ) + FC_ASSERT( next_block.validate_signee( witness.signing_key ) ); - witness_id_type scheduled_witness = get_scheduled_witness( slot_num ).first; - FC_ASSERT( next_block.witness == scheduled_witness ); + if( !skip_witness_schedule_check ) + { + uint32_t slot_num = get_slot_at_time( next_block.timestamp ); + FC_ASSERT( slot_num > 0 ); + + witness_id_type scheduled_witness = get_scheduled_witness( slot_num ).first; + FC_ASSERT( next_block.witness == scheduled_witness ); + } return witness; } diff --git a/libraries/chain/db_management.cpp b/libraries/chain/db_management.cpp index a28d40d3..52bc39b0 100644 --- a/libraries/chain/db_management.cpp +++ b/libraries/chain/db_management.cpp @@ -53,11 +53,12 @@ void database::reindex(fc::path data_dir, const genesis_state_type& initial_allo _undo_db.disable(); for( uint32_t i = 1; i <= last_block_num; ++i ) { - if( i % 1000 == 0 ) std::cerr << " " << double(i*100)/last_block_num << "% \r"; + if( i % 2000 == 0 ) std::cerr << " " << double(i*100)/last_block_num << "% "< database::get_near_witness_schedule()const void database::update_witness_schedule(const signed_block& next_block) { + auto start = fc::time_point::now(); const global_property_object& gpo = get_global_properties(); const witness_schedule_object& wso = get(witness_schedule_id_type()); uint32_t schedule_needs_filled = gpo.active_witnesses.size(); @@ -168,6 +169,12 @@ void database::update_witness_schedule(const signed_block& next_block) (_wso.recent_slots_filled << 1) + 1) << (schedule_slot - 1); }); + auto end = fc::time_point::now(); + static uint64_t total_time = 0; + static uint64_t calls = 0; + total_time += (end - start).count(); + if( ++calls % 1000 == 0 ) + idump( ( double(total_time/1000000.0)/calls) ); } uint32_t database::witness_participation_rate()const diff --git a/libraries/chain/include/graphene/chain/database.hpp b/libraries/chain/include/graphene/chain/database.hpp index 755d18a6..e1a56e90 100644 --- a/libraries/chain/include/graphene/chain/database.hpp +++ b/libraries/chain/include/graphene/chain/database.hpp @@ -89,7 +89,8 @@ namespace graphene { namespace chain { skip_authority_check = 1 << 6, ///< used while reindexing -- disables any checking of authority on transactions skip_merkle_check = 1 << 7, ///< used while reindexing skip_assert_evaluation = 1 << 8, ///< used while reindexing - skip_undo_history_check = 1 << 9 ///< used while reindexing + skip_undo_history_check = 1 << 9, ///< used while reindexing + skip_witness_schedule_check = 1 << 10 ///< used whiel reindexing }; /**