mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
liteServer.getOutMsgQueueSizes method (#943)
Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
438e59a324
commit
b07614335c
9 changed files with 98 additions and 0 deletions
|
@ -973,6 +973,7 @@ bool TestNode::show_help(std::string command) {
|
|||
"savecomplaints <election-id> <filename-pfx>\tSaves all complaints registered for specified validator set id "
|
||||
"into files <filename-pfx><complaint-hash>.boc\n"
|
||||
"complaintprice <expires-in> <complaint-boc>\tComputes the price (in nanograms) for creating a complaint\n"
|
||||
"msgqueuesizes\tShows current sizes of outbound message queues in all shards\n"
|
||||
"known\tShows the list of all known block ids\n"
|
||||
"knowncells\tShows the list of hashes of all known (cached) cells\n"
|
||||
"dumpcell <hex-hash-pfx>\nDumps a cached cell by a prefix of its hash\n"
|
||||
|
@ -1108,6 +1109,8 @@ bool TestNode::do_parse_line() {
|
|||
std::string filename;
|
||||
return parse_uint32(expire_in) && get_word_to(filename) && seekeoln() &&
|
||||
set_error(get_complaint_price(expire_in, filename));
|
||||
} else if (word == "msgqueuesizes") {
|
||||
return get_msg_queue_sizes();
|
||||
} else if (word == "known") {
|
||||
return eoln() && show_new_blkids(true);
|
||||
} else if (word == "knowncells") {
|
||||
|
@ -1611,6 +1614,30 @@ void TestNode::send_compute_complaint_price_query(ton::StdSmcAddress elector_add
|
|||
std::move(P));
|
||||
}
|
||||
|
||||
bool TestNode::get_msg_queue_sizes() {
|
||||
auto q = ton::serialize_tl_object(ton::create_tl_object<ton::lite_api::liteServer_getOutMsgQueueSizes>(0, 0, 0), true);
|
||||
return envelope_send_query(std::move(q), [Self = actor_id(this)](td::Result<td::BufferSlice> res) -> void {
|
||||
if (res.is_error()) {
|
||||
LOG(ERROR) << "liteServer.getOutMsgQueueSizes error: " << res.move_as_error();
|
||||
return;
|
||||
}
|
||||
auto F = ton::fetch_tl_object<ton::lite_api::liteServer_outMsgQueueSizes>(res.move_as_ok(), true);
|
||||
if (F.is_error()) {
|
||||
LOG(ERROR) << "cannot parse answer to liteServer.getOutMsgQueueSizes";
|
||||
return;
|
||||
}
|
||||
td::actor::send_closure_later(Self, &TestNode::got_msg_queue_sizes, F.move_as_ok());
|
||||
});
|
||||
}
|
||||
|
||||
void TestNode::got_msg_queue_sizes(ton::tl_object_ptr<ton::lite_api::liteServer_outMsgQueueSizes> f) {
|
||||
td::TerminalIO::out() << "Outbound message queue sizes:" << std::endl;
|
||||
for (auto &x : f->shards_) {
|
||||
td::TerminalIO::out() << ton::create_block_id(x->id_).id.to_str() << " " << x->size_ << std::endl;
|
||||
}
|
||||
td::TerminalIO::out() << "External message queue size limit: " << f->ext_msg_queue_size_limit_ << std::endl;
|
||||
}
|
||||
|
||||
bool TestNode::dns_resolve_start(ton::WorkchainId workchain, ton::StdSmcAddress addr, ton::BlockIdExt blkid,
|
||||
std::string domain, td::Bits256 cat, int mode) {
|
||||
if (domain.size() >= 2 && domain[0] == '"' && domain.back() == '"') {
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "block/block.h"
|
||||
#include "block/mc-config.h"
|
||||
#include "td/utils/filesystem.h"
|
||||
#include "auto/tl/lite_api.h"
|
||||
|
||||
using td::Ref;
|
||||
|
||||
|
@ -302,6 +303,8 @@ class TestNode : public td::actor::Actor {
|
|||
td::Bits256 chash = td::Bits256::zero(), std::string filename = "");
|
||||
void send_compute_complaint_price_query(ton::StdSmcAddress elector_addr, unsigned expires_in, unsigned bits,
|
||||
unsigned refs, td::Bits256 chash, std::string filename);
|
||||
bool get_msg_queue_sizes();
|
||||
void got_msg_queue_sizes(ton::tl_object_ptr<ton::lite_api::liteServer_outMsgQueueSizes> f);
|
||||
bool cache_cell(Ref<vm::Cell> cell);
|
||||
bool list_cached_cells() const;
|
||||
bool dump_cached_cell(td::Slice hash_pfx, td::Slice type_name = {});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue