Skip to content

Commit

Permalink
Merge pull request #2727 from subspace/fix-plotted-sectors-refactoring
Browse files Browse the repository at this point in the history
Fix plotted sectors refactoring
  • Loading branch information
nazar-pc authored Apr 29, 2024
2 parents 6ad33f1 + 30d7710 commit b70f89d
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions crates/subspace-farmer/src/bin/subspace-farmer/commands/farm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::str::FromStr;
use std::sync::Arc;
use std::time::Duration;
use subspace_core_primitives::crypto::kzg::{embedded_kzg_settings, Kzg};
use subspace_core_primitives::{PublicKey, Record, SectorIndex};
use subspace_core_primitives::{PublicKey, Record};
use subspace_erasure_coding::ErasureCoding;
use subspace_farmer::farm::{
Farm, FarmingNotification, SectorExpirationDetails, SectorPlottingDetails, SectorUpdate,
Expand Down Expand Up @@ -659,22 +659,21 @@ where

plotted_pieces.add_farm(farm_index, farm.piece_reader());

for (sector_index, mut plotted_sectors) in
(0 as SectorIndex..).zip(farm.plotted_sectors().get().await)
{
while let Some(plotted_sector_result) = plotted_sectors.next().await {
match plotted_sector_result {
Ok(plotted_sector) => {
plotted_pieces.add_sector(farm_index, &plotted_sector);
}
Err(error) => {
error!(
%error,
%farm_index,
%sector_index,
"Failed reading plotted sector on startup, skipping"
);
}
let plotted_sectors = farm.plotted_sectors();
let mut plotted_sectors = plotted_sectors.get().await.map_err(|error| {
anyhow!("Failed to get plotted sectors for farm {farm_index}: {error}")
})?;
while let Some(plotted_sector_result) = plotted_sectors.next().await {
match plotted_sector_result {
Ok(plotted_sector) => {
plotted_pieces.add_sector(farm_index, &plotted_sector);
}
Err(error) => {
error!(
%error,
%farm_index,
"Failed reading plotted sector on startup, skipping"
);
}
}
}
Expand Down

0 comments on commit b70f89d

Please sign in to comment.