Skip to content

Commit

Permalink
fix: preserve sealed file data
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptonemo committed Mar 19, 2021
1 parent 55e52f1 commit 75c58b1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions filecoin-proofs/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,20 @@ where
.read(true)
.write(true)
.open(&sealed_path)?;
let mut data = unsafe { MmapOptions::new().map_mut(&mapped_file)? };
let mut data = unsafe { MmapOptions::new().map_copy(&mapped_file)? };

unseal_range_inner::<_, _, Tree>(
let result = unseal_range_inner::<_, _, Tree>(
porep_config,
cache_path,
&mut data,
unsealed_output,
replica_id,
offset,
num_bytes,
)
);
info!("unseal_range_mapped:finish");

result
}

/// Unseals the sector read from `sealed_sector` and returns the bytes for a
Expand Down Expand Up @@ -272,10 +275,10 @@ where
W: Write,
Tree: 'static + MerkleTreeTrait,
{
info!("unseal_range_inner:start");

let base_tree_size = get_base_tree_size::<DefaultBinaryTree>(porep_config.sector_size)?;
let base_tree_leafs = get_base_tree_leafs::<DefaultBinaryTree>(base_tree_size)?;
// MT for original data is always named tree-d, and it will be
// referenced later in the process as such.
let config = StoreConfig::new(
cache_path.as_ref(),
CacheKey::CommDTree.to_string(),
Expand Down

0 comments on commit 75c58b1

Please sign in to comment.