mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
changed validate broadcast logic, added new queries to
validator-engine-console
This commit is contained in:
parent
47814dca3d
commit
d8244eff53
24 changed files with 695 additions and 84 deletions
|
@ -655,3 +655,23 @@ td::Status CreateElectionBidQuery::receive(td::BufferSlice data) {
|
|||
TRY_STATUS(td::write_file(fname_, f->to_send_payload_.as_slice()));
|
||||
return td::Status::OK();
|
||||
}
|
||||
|
||||
td::Status CheckDhtServersQuery::run() {
|
||||
TRY_RESULT_ASSIGN(id_, tokenizer_.get_token<ton::PublicKeyHash>());
|
||||
return td::Status::OK();
|
||||
}
|
||||
|
||||
td::Status CheckDhtServersQuery::send() {
|
||||
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_checkDhtServers>(id_.tl());
|
||||
td::actor::send_closure(console_, &ValidatorEngineConsole::envelope_send_query, std::move(b), create_promise());
|
||||
return td::Status::OK();
|
||||
}
|
||||
|
||||
td::Status CheckDhtServersQuery::receive(td::BufferSlice data) {
|
||||
TRY_RESULT_PREFIX(f, ton::fetch_tl_object<ton::ton_api::engine_validator_dhtServersStatus>(data.as_slice(), true),
|
||||
"received incorrect answer: ");
|
||||
for (auto &s : f->servers_) {
|
||||
td::TerminalIO::out() << "id=" << s->id_ << " status=" << (s->status_ ? "SUCCESS" : "FAIL") << "\n";
|
||||
}
|
||||
return td::Status::OK();
|
||||
}
|
||||
|
|
|
@ -821,3 +821,24 @@ class CreateElectionBidQuery : public Query {
|
|||
std::string fname_;
|
||||
};
|
||||
|
||||
class CheckDhtServersQuery : public Query {
|
||||
public:
|
||||
CheckDhtServersQuery(td::actor::ActorId<ValidatorEngineConsole> console, Tokenizer tokenizer)
|
||||
: Query(console, std::move(tokenizer)) {
|
||||
}
|
||||
td::Status run() override;
|
||||
td::Status send() override;
|
||||
td::Status receive(td::BufferSlice data) override;
|
||||
static std::string get_name() {
|
||||
return "checkdht";
|
||||
}
|
||||
static std::string get_help() {
|
||||
return "checkdht <adnlid>\tchecks, which root DHT servers are accessible from this ADNL addr";
|
||||
}
|
||||
std::string name() const override {
|
||||
return get_name();
|
||||
}
|
||||
|
||||
private:
|
||||
ton::PublicKeyHash id_;
|
||||
};
|
||||
|
|
|
@ -130,6 +130,7 @@ void ValidatorEngineConsole::run() {
|
|||
add_query_runner(std::make_unique<QueryRunnerImpl<AddNetworkAddressQuery>>());
|
||||
add_query_runner(std::make_unique<QueryRunnerImpl<AddNetworkProxyAddressQuery>>());
|
||||
add_query_runner(std::make_unique<QueryRunnerImpl<CreateElectionBidQuery>>());
|
||||
add_query_runner(std::make_unique<QueryRunnerImpl<CheckDhtServersQuery>>());
|
||||
}
|
||||
|
||||
bool ValidatorEngineConsole::envelope_send_query(td::BufferSlice query, td::Promise<td::BufferSlice> promise) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue