mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Add unsafe-catchain-rotate option to validator engine
This commit is contained in:
parent
8c6122beb2
commit
4062466bba
2 changed files with 19 additions and 0 deletions
|
@ -1324,6 +1324,9 @@ td::Status ValidatorEngine::load_global_config() {
|
|||
for (auto seq : unsafe_catchains_) {
|
||||
validator_options_.write().add_unsafe_resync_catchain(seq);
|
||||
}
|
||||
for (auto rot : unsafe_catchain_rotations_) {
|
||||
validator_options_.write().add_unsafe_catchain_rotate(rot.first, rot.second.first, rot.second.second);
|
||||
}
|
||||
if (truncate_seqno_ > 0) {
|
||||
validator_options_.write().truncate_db(truncate_seqno_);
|
||||
}
|
||||
|
@ -3364,6 +3367,18 @@ int main(int argc, char *argv[]) {
|
|||
acts.push_back([&x, seq]() { td::actor::send_closure(x, &ValidatorEngine::add_unsafe_catchain, seq); });
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_checked_option(
|
||||
'F', "unsafe-catchain-rotate", "use forceful and DANGEROUS catchain rotation", [&](td::Slice params) {
|
||||
auto pos1 = params.find(':');
|
||||
TRY_RESULT(b_seq, td::to_integer_safe<ton::BlockSeqno>(params.substr(0, pos1)));
|
||||
params = params.substr(++pos1, params.size());
|
||||
auto pos2 = params.find(':');
|
||||
TRY_RESULT(cc_seq, td::to_integer_safe<ton::CatchainSeqno>(params.substr(0, pos2)));
|
||||
params = params.substr(++pos2, params.size());
|
||||
auto h = std::stoi(params.substr(0, params.size()).str());
|
||||
acts.push_back([&x, b_seq, cc_seq, h]() { td::actor::send_closure(x, &ValidatorEngine::add_unsafe_catchain_rotation, b_seq, cc_seq, h); });
|
||||
return td::Status::OK();
|
||||
});
|
||||
td::uint32 threads = 7;
|
||||
p.add_checked_option(
|
||||
't', "threads", PSTRING() << "number of threads (default=" << threads << ")", [&](td::Slice fname) {
|
||||
|
|
|
@ -201,6 +201,7 @@ class ValidatorEngine : public td::actor::Actor {
|
|||
ton::BlockSeqno truncate_seqno_{0};
|
||||
|
||||
std::set<ton::CatchainSeqno> unsafe_catchains_;
|
||||
std::map<ton::BlockSeqno, std::pair<ton::CatchainSeqno, td::uint32>> unsafe_catchain_rotations_;
|
||||
|
||||
public:
|
||||
static constexpr td::uint8 max_cat() {
|
||||
|
@ -210,6 +211,9 @@ class ValidatorEngine : public td::actor::Actor {
|
|||
void add_unsafe_catchain(ton::CatchainSeqno seq) {
|
||||
unsafe_catchains_.insert(seq);
|
||||
}
|
||||
void add_unsafe_catchain_rotation(ton::BlockSeqno b_seqno, ton::CatchainSeqno cc_seqno, td::uint32 value) {
|
||||
unsafe_catchain_rotations_.insert({b_seqno, {cc_seqno, value}});
|
||||
}
|
||||
void set_local_config(std::string str);
|
||||
void set_global_config(std::string str);
|
||||
void set_fift_dir(std::string str) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue