From 52878b6709734f7b126e5aa97de834c98ba5f148 Mon Sep 17 00:00:00 2001 From: bruno-valante <140794260+bruno-valante@users.noreply.github.com> Date: Sun, 8 Sep 2024 08:37:03 +0800 Subject: [PATCH] Fix recall range computation for sharding (#186) * Fix recall range computation for sharding * cargo fmt --- node/miner/src/mine.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node/miner/src/mine.rs b/node/miner/src/mine.rs index 9994a89..571ef69 100644 --- a/node/miner/src/mine.rs +++ b/node/miner/src/mine.rs @@ -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 =