@@ -929,6 +929,53 @@ void ValidatorSessionImpl::get_current_stats(td::Promise<ValidatorSessionStats>
929929 promise.set_result (std::move (stats));
930930}
931931
932+ void ValidatorSessionImpl::get_validator_group_info_for_litequery (
933+ td::uint32 cur_round,
934+ td::Promise<std::vector<tl_object_ptr<lite_api::liteServer_nonfinal_candidateInfo>>> promise) {
935+ if (cur_round != cur_round_ || real_state_->cur_round_seqno () != cur_round) {
936+ promise.set_value ({});
937+ return ;
938+ }
939+ std::vector<tl_object_ptr<lite_api::liteServer_nonfinal_candidateInfo>> result;
940+ real_state_->for_each_cur_round_sent_block ([&](const SessionBlockCandidate *block) {
941+ if (block->get_block () == nullptr ) {
942+ return ;
943+ }
944+ auto candidate = create_tl_object<lite_api::liteServer_nonfinal_candidateInfo>();
945+
946+ candidate->id_ = create_tl_object<lite_api::liteServer_nonfinal_candidateId>();
947+ candidate->id_ ->block_id_ = create_tl_object<lite_api::tonNode_blockIdExt>();
948+ candidate->id_ ->block_id_ ->root_hash_ =
949+ block->get_block ()->get_root_hash (); // other fields will be filled in validator-group.cpp
950+ candidate->id_ ->block_id_ ->file_hash_ = block->get_block ()->get_file_hash ();
951+ candidate->id_ ->creator_ =
952+ description ().get_source_public_key (block->get_block ()->get_src_idx ()).ed25519_value ().raw ();
953+ candidate->id_ ->collated_data_hash_ = block->get_block ()->get_collated_data_file_hash ();
954+
955+ candidate->total_weight_ = description ().get_total_weight ();
956+ candidate->approved_weight_ = 0 ;
957+ candidate->signed_weight_ = 0 ;
958+ for (td::uint32 i = 0 ; i < description ().get_total_nodes (); ++i) {
959+ if (real_state_->check_block_is_approved_by (description (), i, block->get_id ())) {
960+ candidate->approved_weight_ += description ().get_node_weight (i);
961+ }
962+ }
963+ auto precommited = real_state_->get_cur_round_precommitted_block ();
964+ if (SentBlock::get_block_id (precommited) == SentBlock::get_block_id (block->get_block ())) {
965+ auto signatures = real_state_->get_cur_round_signatures ();
966+ if (signatures) {
967+ for (td::uint32 i = 0 ; i < description ().get_total_nodes (); ++i) {
968+ if (signatures->at (i)) {
969+ candidate->signed_weight_ += description ().get_node_weight (i);
970+ }
971+ }
972+ }
973+ }
974+ result.push_back (std::move (candidate));
975+ });
976+ promise.set_result (std::move (result));
977+ }
978+
932979void ValidatorSessionImpl::start_up () {
933980 CHECK (!rldp_.empty ());
934981 cur_round_ = 0 ;
0 commit comments