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

Remove obsolete interface for importing blocks

This commit is contained in:
SpyCheese 2022-08-08 12:41:28 +03:00
parent 51e6885f2c
commit 7241522de2
13 changed files with 0 additions and 385 deletions

View file

@ -1029,69 +1029,6 @@ td::Status GetValidatorSessionsInfoQuery::receive(td::BufferSlice data) {
return td::Status::OK();
}
td::Status GenerateBlockCandidateQuery::run() {
TRY_RESULT_ASSIGN(wc_, tokenizer_.get_token<td::int32>());
TRY_RESULT_ASSIGN(shard_, tokenizer_.get_token<td::int64>() );
TRY_RESULT_ASSIGN(seqno_, tokenizer_.get_token<td::int32>());
TRY_RESULT_ASSIGN(file_, tokenizer_.get_token<std::string>());
return td::Status::OK();
}
td::Status GenerateBlockCandidateQuery::send() {
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_generateBlockCandidate>(
ton::create_tl_block_id_simple(ton::BlockId(wc_, shard_, seqno_)));
td::actor::send_closure(console_, &ValidatorEngineConsole::envelope_send_query, std::move(b), create_promise());
return td::Status::OK();
}
td::Status GenerateBlockCandidateQuery::receive(td::BufferSlice data) {
TRY_RESULT_PREFIX(f, ton::fetch_tl_object<ton::ton_api::db_candidate>(data.as_slice(), true),
"received incorrect answer: ");
TRY_STATUS_PREFIX(td::write_file(file_, data.as_slice()), "failed to write block to file");
td::TerminalIO::out() << "successfully written candidate to file\n";
return td::Status::OK();
}
td::Status GetRequiredBlockCandidatesQuery::run() {
TRY_STATUS(tokenizer_.check_endl());
return td::Status::OK();
}
td::Status GetRequiredBlockCandidatesQuery::send() {
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_getRequiredBlockCandidates>();
td::actor::send_closure(console_, &ValidatorEngineConsole::envelope_send_query, std::move(b), create_promise());
return td::Status::OK();
}
td::Status GetRequiredBlockCandidatesQuery::receive(td::BufferSlice data) {
TRY_RESULT_PREFIX(
f, ton::fetch_tl_object<ton::ton_api::engine_validator_requiredBlockCandidates>(data.as_slice(), true),
"received incorrect answer: ");
td::TerminalIO::out() << td::json_encode<std::string>(td::ToJson(*f), true);
return td::Status::OK();
}
td::Status ImportBlockCandidateQuery::run() {
TRY_RESULT_ASSIGN(file_, tokenizer_.get_token<std::string>());
return td::Status::OK();
}
td::Status ImportBlockCandidateQuery::send() {
TRY_RESULT(data, td::read_file(file_));
TRY_RESULT_PREFIX(candidate, ton::fetch_tl_object<ton::ton_api::db_candidate>(data.as_slice(), true),
"invalid file: ");
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_importBlockCandidate>(std::move(candidate));
td::actor::send_closure(console_, &ValidatorEngineConsole::envelope_send_query, std::move(b), create_promise());
return td::Status::OK();
}
td::Status ImportBlockCandidateQuery::receive(td::BufferSlice data) {
TRY_RESULT_PREFIX(f, ton::fetch_tl_object<ton::ton_api::engine_validator_success>(data.as_slice(), true),
"received incorrect answer: ");
td::TerminalIO::out() << "successfully imported a block candidate\n";
return td::Status::OK();
}
td::Status AddCollatorQuery::run() {
TRY_RESULT_ASSIGN(adnl_id_, tokenizer_.get_token<ton::PublicKeyHash>());
TRY_RESULT_ASSIGN(wc_, tokenizer_.get_token<td::int32>());

View file

@ -1094,76 +1094,6 @@ class GetValidatorSessionsInfoQuery : public Query {
}
};
class GenerateBlockCandidateQuery : public Query {
public:
GenerateBlockCandidateQuery(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 "genblock";
}
static std::string get_help() {
return "genblock <wc> <shard> <seqno> <file>\t"
"generate a block candidate for a given shard (seqno mush match the next seqno for the shard), "
"candidate is saved to <file>";
}
std::string name() const override {
return get_name();
}
private:
td::int32 wc_;
td::int64 shard_;
td::int32 seqno_;
std::string file_;
};
class GetRequiredBlockCandidatesQuery : public Query {
public:
GetRequiredBlockCandidatesQuery(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 "getrequiredblockcandidates";
}
static std::string get_help() {
return "getrequiredblockcandidates\t"
"get a list of block candidates that the validator is currently waiting for";
}
std::string name() const override {
return get_name();
}
};
class ImportBlockCandidateQuery : public Query {
public:
ImportBlockCandidateQuery(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 "importblockcandidate";
}
static std::string get_help() {
return "importblockcandidate <file>\t"
"load a block candidate from a given file";
}
std::string name() const override {
return get_name();
}
private:
std::string file_;
};
class AddCollatorQuery : public Query {
public:
AddCollatorQuery(td::actor::ActorId<ValidatorEngineConsole> console, Tokenizer tokenizer)

View file

@ -141,9 +141,6 @@ void ValidatorEngineConsole::run() {
add_query_runner(std::make_unique<QueryRunnerImpl<ImportShardOverlayCertificateQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<SignShardOverlayCertificateQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<GetValidatorSessionsInfoQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<GenerateBlockCandidateQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<GetRequiredBlockCandidatesQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<ImportBlockCandidateQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<AddCollatorQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<AddShardQuery>>());
}