Fix recall range computation for sharding (#186)

* Fix recall range computation for sharding

* cargo fmt
This commit is contained in:
bruno-valante 2024-09-08 08:37:03 +08:00 committed by GitHub
parent 43c2d5f788
commit 52878b6709
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,7 +75,11 @@ impl MineRangeConfig {
let minable_length =
(context.flow_length.as_u64() / SECTORS_PER_LOAD as u64) * SECTORS_PER_LOAD as u64;
let mining_length = std::cmp::min(minable_length, SECTORS_PER_MAX_MINING_RANGE as u64);
let num_shards = 1u64 << self.shard_config.miner_shard_mask().count_zeros();
let mining_length = std::cmp::min(
minable_length,
(SECTORS_PER_MAX_MINING_RANGE as u64).saturating_mul(num_shards),
);
let start_position = std::cmp::min(self_start_position, minable_length - mining_length);
let start_position =