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

Add CollatorNode and make validators request blocks from it

This commit is contained in:
SpyCheese 2022-07-20 15:39:50 +03:00
parent 996c23e506
commit 53270a00e6
25 changed files with 577 additions and 33 deletions

View file

@ -1091,3 +1091,24 @@ td::Status ImportBlockCandidateQuery::receive(td::BufferSlice data) {
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>());
TRY_RESULT_ASSIGN(shard_, tokenizer_.get_token<td::int64>());
return td::Status::OK();
}
td::Status AddCollatorQuery::send() {
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_addCollator>(
adnl_id_.tl(), wc_, shard_);
td::actor::send_closure(console_, &ValidatorEngineConsole::envelope_send_query, std::move(b), create_promise());
return td::Status::OK();
}
td::Status AddCollatorQuery::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 added collator\n";
return td::Status::OK();
}