From d23f3bc22f4a3b34270f5df3e94c9e64ed05e67f Mon Sep 17 00:00:00 2001 From: Volker Mische Date: Wed, 13 Sep 2023 16:39:39 +0200 Subject: [PATCH] refactor: make configuration more obvious (#1716) Instead of creating two configs, that depend on each other, create a single one in the most straightforward way. --- .../src/stacked/vanilla/proof.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/storage-proofs-porep/src/stacked/vanilla/proof.rs b/storage-proofs-porep/src/stacked/vanilla/proof.rs index d8e553779..c612ec911 100644 --- a/storage-proofs-porep/src/stacked/vanilla/proof.rs +++ b/storage-proofs-porep/src/stacked/vanilla/proof.rs @@ -1930,16 +1930,12 @@ impl<'a, Tree: 'static + MerkleTreeTrait, G: 'static + Hasher> StackedDrg<'a, Tr let tree_count = get_base_tree_count::(); let nodes_count = leaf_count / tree_count; - let config = StoreConfig::new( - cache_path.as_ref(), - CacheKey::CommRLastTree.to_string(), - default_rows_to_discard(nodes_count, Tree::Arity::to_usize()), - ); - let tree_r_last_config = StoreConfig::from_config( - &config, - CacheKey::CommRLastTree.to_string(), - Some(get_merkle_tree_len(nodes_count, Tree::Arity::to_usize())?), - ); + let tree_r_last_config = StoreConfig { + path: cache_path.as_ref().into(), + id: CacheKey::CommRLastTree.to_string(), + size: Some(get_merkle_tree_len(nodes_count, Tree::Arity::to_usize())?), + rows_to_discard: default_rows_to_discard(nodes_count, Tree::Arity::to_usize()), + }; // Encode original data into the last layer. info!("building tree_r_last");