mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Fix QueueSizeCounter and ValidatorGroup after merge
This commit is contained in:
parent
a2eb3f3631
commit
747b24aa18
8 changed files with 31 additions and 16 deletions
|
@ -654,7 +654,7 @@ void FullNodeImpl::update_private_block_overlays() {
|
|||
}
|
||||
|
||||
void FullNodeImpl::create_private_block_overlay(PublicKeyHash key) {
|
||||
CHECK(local_keys_.count(key));
|
||||
/*CHECK(local_keys_.count(key));
|
||||
if (current_validators_.count(key)) {
|
||||
std::vector<adnl::AdnlNodeIdShort> nodes;
|
||||
for (const auto &p : current_validators_) {
|
||||
|
@ -663,7 +663,7 @@ void FullNodeImpl::create_private_block_overlay(PublicKeyHash key) {
|
|||
private_block_overlays_[key] = td::actor::create_actor<FullNodePrivateOverlay>(
|
||||
"BlocksPrivateOverlay", current_validators_[key], std::move(nodes), zero_state_file_hash_, config_, keyring_,
|
||||
adnl_, rldp_, rldp2_, overlays_, validator_manager_);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
FullNodeImpl::FullNodeImpl(PublicKeyHash local_id, adnl::AdnlNodeIdShort adnl_id, FileHash zero_state_file_hash,
|
||||
|
|
|
@ -388,8 +388,8 @@ class ValidatorManagerImpl : public ValidatorManager {
|
|||
}
|
||||
void get_out_msg_queue_size(BlockIdExt block_id, td::Promise<td::uint32> promise) override {
|
||||
if (queue_size_counter_.empty()) {
|
||||
queue_size_counter_ =
|
||||
td::actor::create_actor<QueueSizeCounter>("queuesizecounter", td::Ref<MasterchainState>{}, actor_id(this));
|
||||
queue_size_counter_ = td::actor::create_actor<QueueSizeCounter>("queuesizecounter", td::Ref<MasterchainState>{},
|
||||
opts_, actor_id(this));
|
||||
}
|
||||
td::actor::send_closure(queue_size_counter_, &QueueSizeCounter::get_queue_size, block_id, std::move(promise));
|
||||
}
|
||||
|
|
|
@ -450,8 +450,8 @@ class ValidatorManagerImpl : public ValidatorManager {
|
|||
}
|
||||
void get_out_msg_queue_size(BlockIdExt block_id, td::Promise<td::uint32> promise) override {
|
||||
if (queue_size_counter_.empty()) {
|
||||
queue_size_counter_ =
|
||||
td::actor::create_actor<QueueSizeCounter>("queuesizecounter", td::Ref<MasterchainState>{}, actor_id(this));
|
||||
queue_size_counter_ = td::actor::create_actor<QueueSizeCounter>("queuesizecounter", td::Ref<MasterchainState>{},
|
||||
opts_, actor_id(this));
|
||||
}
|
||||
td::actor::send_closure(queue_size_counter_, &QueueSizeCounter::get_queue_size, block_id, std::move(promise));
|
||||
}
|
||||
|
|
|
@ -3115,6 +3115,9 @@ void ValidatorManagerImpl::update_options(td::Ref<ValidatorManagerOptions> opts)
|
|||
if (!out_msg_queue_importer_.empty()) {
|
||||
td::actor::send_closure(out_msg_queue_importer_, &OutMsgQueueImporter::update_options, opts);
|
||||
}
|
||||
if (!queue_size_counter_.empty()) {
|
||||
td::actor::send_closure(queue_size_counter_, &QueueSizeCounter::update_options, opts);
|
||||
}
|
||||
opts_ = std::move(opts);
|
||||
}
|
||||
|
||||
|
|
|
@ -591,13 +591,17 @@ class ValidatorManagerImpl : public ValidatorManager {
|
|||
void update_options(td::Ref<ValidatorManagerOptions> opts) override;
|
||||
|
||||
void get_out_msg_queue_size(BlockIdExt block_id, td::Promise<td::uint32> promise) override {
|
||||
if (queue_size_counter_.empty()) {
|
||||
if (last_masterchain_state_.is_null()) {
|
||||
promise.set_error(td::Status::Error(ErrorCode::notready, "not ready"));
|
||||
return;
|
||||
}
|
||||
queue_size_counter_ = td::actor::create_actor<QueueSizeCounter>("queuesizecounter",
|
||||
last_masterchain_state_, actor_id(this));
|
||||
if (queue_size_counter_.empty()) {
|
||||
queue_size_counter_ =
|
||||
td::actor::create_actor<QueueSizeCounter>("queuesizecounter", last_masterchain_state_, opts_, actor_id(this));
|
||||
}
|
||||
if (!opts_->need_monitor(block_id.shard_full(), last_masterchain_state_)) {
|
||||
return promise.set_error(
|
||||
td::Status::Error(PSTRING() << "not monitoring shard " << block_id.shard_full().to_str()));
|
||||
}
|
||||
td::actor::send_closure(queue_size_counter_, &QueueSizeCounter::get_queue_size, block_id, std::move(promise));
|
||||
}
|
||||
|
|
|
@ -234,8 +234,10 @@ void QueueSizeCounter::process_top_shard_blocks_cont(td::Ref<MasterchainState> s
|
|||
last_top_blocks_.clear();
|
||||
last_top_blocks_.push_back(state->get_block_id());
|
||||
for (auto &shard : state->get_shards()) {
|
||||
if (opts_->need_monitor(shard->shard(), state)) {
|
||||
last_top_blocks_.push_back(shard->top_block_id());
|
||||
}
|
||||
}
|
||||
for (const BlockIdExt &block_id : last_top_blocks_) {
|
||||
get_queue_size_ex_retry(block_id, init, ig.get_promise());
|
||||
}
|
||||
|
|
|
@ -21,16 +21,22 @@ namespace ton::validator {
|
|||
|
||||
class QueueSizeCounter : public td::actor::Actor {
|
||||
public:
|
||||
QueueSizeCounter(td::Ref<MasterchainState> last_masterchain_state, td::actor::ActorId<ValidatorManager> manager)
|
||||
: init_masterchain_state_(last_masterchain_state), manager_(std::move(manager)) {
|
||||
QueueSizeCounter(td::Ref<MasterchainState> last_masterchain_state, td::Ref<ValidatorManagerOptions> opts,
|
||||
td::actor::ActorId<ValidatorManager> manager)
|
||||
: init_masterchain_state_(last_masterchain_state), opts_(std::move(opts)), manager_(std::move(manager)) {
|
||||
}
|
||||
|
||||
void start_up() override;
|
||||
void get_queue_size(BlockIdExt block_id, td::Promise<td::uint32> promise);
|
||||
void alarm() override;
|
||||
|
||||
void update_options(td::Ref<ValidatorManagerOptions> opts) {
|
||||
opts_ = std::move(opts);
|
||||
}
|
||||
|
||||
private:
|
||||
td::Ref<MasterchainState> init_masterchain_state_;
|
||||
td::Ref<ValidatorManagerOptions> opts_;
|
||||
td::actor::ActorId<ValidatorManager> manager_;
|
||||
bool simple_mode_ = false;
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ void ValidatorGroup::accept_block_query(BlockIdExt block_id, td::Ref<BlockData>
|
|||
}
|
||||
});
|
||||
|
||||
run_accept_block_query(block_id, std::move(block), prev_block_ids_, validator_set_, std::move(sig_set),
|
||||
run_accept_block_query(block_id, std::move(block), std::move(prev), validator_set_, std::move(sig_set),
|
||||
std::move(approve_sig_set), send_broadcast,
|
||||
shard_.is_masterchain() || mode_ == ValidatorManagerOptions::validator_normal, manager_,
|
||||
std::move(P));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue