mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Merge branch 'safe_features' into testnet-update
This commit is contained in:
commit
feff73c4be
41 changed files with 1066 additions and 207 deletions
|
@ -814,13 +814,25 @@ void ValidatorSessionImpl::request_new_block(bool now) {
|
|||
} else {
|
||||
double lambda = 10.0 / description().get_total_nodes();
|
||||
double x = -1 / lambda * log(td::Random::fast(1, 999) * 0.001);
|
||||
if (x > catchain_max_block_delay_) { // default = 0.5
|
||||
x = catchain_max_block_delay_;
|
||||
}
|
||||
x = std::min(x, get_current_max_block_delay()); // default = 0.4
|
||||
td::actor::send_closure(catchain_, &catchain::CatChain::need_new_block, td::Timestamp::in(x));
|
||||
}
|
||||
}
|
||||
|
||||
double ValidatorSessionImpl::get_current_max_block_delay() const {
|
||||
td::uint32 att = real_state_->cur_attempt_in_round(*description_);
|
||||
td::uint32 att1 = description_->opts().max_round_attempts;
|
||||
if (att <= att1) {
|
||||
return catchain_max_block_delay_;
|
||||
}
|
||||
td::uint32 att2 = att1 + 4;
|
||||
if (att >= att2) {
|
||||
return catchain_max_block_delay_slow_;
|
||||
}
|
||||
return catchain_max_block_delay_ +
|
||||
(catchain_max_block_delay_slow_ - catchain_max_block_delay_) * (double)(att - att1) / (double)(att2 - att1);
|
||||
}
|
||||
|
||||
void ValidatorSessionImpl::on_new_round(td::uint32 round) {
|
||||
if (round != 0) {
|
||||
CHECK(cur_round_ < round);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue