1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

minor improvements and bugfixes

This commit is contained in:
ton 2020-05-07 10:35:23 +04:00
parent eecf05ca59
commit 040df63c98
24 changed files with 665 additions and 344 deletions

View file

@ -678,6 +678,29 @@ td::Status CreateProposalVoteQuery::receive(td::BufferSlice data) {
return td::Status::OK();
}
td::Status CreateComplaintVoteQuery::run() {
TRY_RESULT_ASSIGN(election_id_, tokenizer_.get_token<td::uint32>());
TRY_RESULT_ASSIGN(data_, tokenizer_.get_token<std::string>());
TRY_RESULT_ASSIGN(fname_, tokenizer_.get_token<std::string>());
TRY_STATUS(tokenizer_.check_endl());
return td::Status::OK();
}
td::Status CreateComplaintVoteQuery::send() {
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_createComplaintVote>(election_id_,
td::BufferSlice(data_));
td::actor::send_closure(console_, &ValidatorEngineConsole::envelope_send_query, std::move(b), create_promise());
return td::Status::OK();
}
td::Status CreateComplaintVoteQuery::receive(td::BufferSlice data) {
TRY_RESULT_PREFIX(f, ton::fetch_tl_object<ton::ton_api::engine_validator_proposalVote>(data.as_slice(), true),
"received incorrect answer: ");
td::TerminalIO::out() << "success: permkey=" << f->perm_key_.to_hex() << "\n";
TRY_STATUS(td::write_file(fname_, f->to_send_.as_slice()));
return td::Status::OK();
}
td::Status CheckDhtServersQuery::run() {
TRY_RESULT_ASSIGN(id_, tokenizer_.get_token<ton::PublicKeyHash>());
return td::Status::OK();

View file

@ -858,6 +858,30 @@ class CreateProposalVoteQuery : public Query {
std::string fname_;
};
class CreateComplaintVoteQuery : public Query {
public:
CreateComplaintVoteQuery(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 "createcomplaintvote";
}
static std::string get_help() {
return "createcomplaintvote <election-id> <data> <fname>\tcreate proposal vote";
}
std::string name() const override {
return get_name();
}
private:
td::uint32 election_id_;
std::string data_;
std::string fname_;
};
class CheckDhtServersQuery : public Query {
public:
CheckDhtServersQuery(td::actor::ActorId<ValidatorEngineConsole> console, Tokenizer tokenizer)

View file

@ -131,6 +131,7 @@ void ValidatorEngineConsole::run() {
add_query_runner(std::make_unique<QueryRunnerImpl<AddNetworkProxyAddressQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<CreateElectionBidQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<CreateProposalVoteQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<CreateComplaintVoteQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<CheckDhtServersQuery>>());
}