void node::on_signin_request( const shared_ptr<peer_connection>& con, const signin_request& request ) { try { fc::ecc::public_key signin_key( request.signature, fc::sha256::hash( (char*)&con->_shared_secret, sizeof(con->_shared_secret) ) ); auto chain = _client->get_chain(); auto account = chain->get_account_record( signin_key ); FC_ASSERT( account.valid() ); auto active_delegate_ids = chain->get_active_delegates(); auto location = std::find( active_delegate_ids.begin(), active_delegate_ids.end(), account->id ); FC_ASSERT( location != active_delegate_ids.end(), "You must be an active delgate to login" ) con->info.delegate_ids.push_back( signin_key ); } FC_CAPTURE_AND_RETHROW() }
bool chain_interface::is_active_delegate( const account_id_type& id )const { try { const auto active = get_active_delegates(); return active.end() != std::find( active.begin(), active.end(), id ); } FC_RETHROW_EXCEPTIONS( warn, "", ("id",id) ) }