diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 63b11a21..097c611e 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -1118,10 +1118,12 @@ vector database_api::lookup_vote_ids( const vector& votes vector database_api_impl::lookup_vote_ids( const vector& votes )const { - FC_ASSERT( votes.size() < 100, "Only 100 votes can be queried at a time" ); + FC_ASSERT( votes.size() < 1000, "Only 1000 votes can be queried at a time" ); const auto& witness_idx = _db.get_index_type().indices().get(); const auto& committee_idx = _db.get_index_type().indices().get(); + const auto& for_worker_idx = _db.get_index_type().indices().get(); + const auto& against_worker_idx = _db.get_index_type().indices().get(); vector result; result.reserve( votes.size() ); @@ -1148,7 +1150,22 @@ vector database_api_impl::lookup_vote_ids( const vector& break; } case vote_id_type::worker: + { + auto itr = for_worker_idx.find( id ); + if( itr != for_worker_idx.end() ) { + result.emplace_back( variant( *itr ) ); + } + else { + auto itr = against_worker_idx.find( id ); + if( itr != against_worker_idx.end() ) { + result.emplace_back( variant( *itr ) ); + } + else { + result.emplace_back( variant() ); + } + } break; + } case vote_id_type::VOTE_TYPE_COUNT: break; // supress unused enum value warnings } }