mirror of
https://github.com/ton-blockchain/ton
synced 2025-02-15 04:32:21 +00:00
Change format of specifying shards to monitor
This commit is contained in:
parent
c2e7d0b0de
commit
86250706b8
4 changed files with 7 additions and 4 deletions
|
@ -81,6 +81,9 @@ int TestNode::LiteServer::max_common_prefix(ton::ShardIdFull shard) const {
|
|||
}
|
||||
int res = -1;
|
||||
for (const ton::ShardIdFull &our_shard : shards) {
|
||||
if (ton::shard_is_ancestor(our_shard, shard)) {
|
||||
return shard.pfx_len();
|
||||
}
|
||||
if (shard.workchain == our_shard.workchain) {
|
||||
int x = std::min({shard.pfx_len(), our_shard.pfx_len(), ton::count_matching_bits(shard.shard, our_shard.shard)});
|
||||
res = std::max(res, x);
|
||||
|
@ -92,7 +95,7 @@ int TestNode::LiteServer::max_common_prefix(ton::ShardIdFull shard) const {
|
|||
bool TestNode::LiteServer::supports_shard(ton::ShardIdFull shard) const {
|
||||
return is_full || shard.is_masterchain() ||
|
||||
std::any_of(shards.begin(), shards.end(),
|
||||
[&](const ton::ShardIdFull& our_shard) { return ton::shard_is_ancestor(shard, our_shard); });
|
||||
[&](const ton::ShardIdFull& our_shard) { return ton::shard_intersects(shard, our_shard); });
|
||||
}
|
||||
|
||||
void TestNode::run() {
|
||||
|
|
|
@ -1413,7 +1413,7 @@ void ValidatorEngine::set_shard_check_function() {
|
|||
validator_options_.write().set_shard_check_function(
|
||||
[shards = std::move(shards)](ton::ShardIdFull shard) -> bool {
|
||||
for (auto s : shards) {
|
||||
if (shard_is_ancestor(shard, s)) {
|
||||
if (shard_intersects(shard, s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ void CollatorNode::receive_query_cont(adnl::AdnlNodeIdShort src, ShardIdFull sha
|
|||
|
||||
bool CollatorNode::collate_shard(ShardIdFull shard) const {
|
||||
for (ShardIdFull our_shard : shards_) {
|
||||
if (shard_is_ancestor(shard, our_shard)) {
|
||||
if (shard_intersects(shard, our_shard)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ void ValidatorGroup::send_collate_query(td::uint32 round_id, td::Timestamp timeo
|
|||
// TODO: some way to choose node (similar to "unreliability" in full-node)
|
||||
int cnt = 0;
|
||||
for (const block::CollatorNodeDescr& c : collator_config_.collator_nodes) {
|
||||
if (shard_is_ancestor(shard_, c.shard) && td::Random::fast(0, cnt) == 0) {
|
||||
if (shard_intersects(shard_, c.shard) && td::Random::fast(0, cnt) == 0) {
|
||||
collator = adnl::AdnlNodeIdShort(c.adnl_id);
|
||||
++cnt;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue