diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index b571f88748..6c6e3f1d6a 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -131,8 +131,19 @@ bool database::_push_block(const signed_block& new_block) uint32_t skip = get_node_properties().skip_flags; if( !(skip&skip_fork_db) ) { - /// TODO: if the block is greater than the head block and before the next maitenance interval - // verify that the block signer is in the current set of active witnesses. + + // If the block is greater than the head block and before the next maintenance interval + if (new_block.block_num() > head_block_num() + && new_block.timestamp < get_dynamic_global_properties().next_maintenance_time ) + { + // make sure the block signer is in the current set of active witnesses + const auto& witnesses = get_global_properties().active_witnesses; + witnesses.find(new_block.witness); + if ( witnesses.find(new_block.witness) == witnesses.end() ) + { + FC_THROW_EXCEPTION(fc::assert_exception, "database::_push_block: Block witness not in list of active witnesses."); + } + } shared_ptr new_head = _fork_db.push_block(new_block); //If the head block from the longest chain does not build off of the current head, we need to switch forks.