Skip to content

Commit

Permalink
Merge branch 'debug' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
madadam committed Oct 9, 2024
2 parents 13f6d1a + 3d90f6e commit 67c8faf
Show file tree
Hide file tree
Showing 11 changed files with 555 additions and 173 deletions.
16 changes: 12 additions & 4 deletions lib/src/blob/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,16 +645,24 @@ async fn read_block(
locator: &Locator,
read_key: &cipher::SecretKey,
) -> Result<(BlockId, BlockContent)> {
let (id, _) = tx
let (block_id, _) = tx
.find_block_at(root_node, &locator.encode(read_key))
.await?;
.await
.inspect_err(|error| {
tracing::trace!(?error, root_hash = ?root_node.proof.hash, ?locator);
})?;

let mut content = BlockContent::new();
let nonce = tx.read_block(&id, &mut content).await?;
let nonce = tx
.read_block(&block_id, &mut content)
.await
.inspect_err(|error| {
tracing::trace!(?error, root_hash = ?root_node.proof.hash, ?locator, ?block_id);
})?;

decrypt_block(read_key, &nonce, &mut content);

Ok((id, content))
Ok((block_id, content))
}

fn write_block(
Expand Down
12 changes: 12 additions & 0 deletions lib/src/crypto/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,18 @@ where
}
}

impl<T> Clone for CacheHash<T>
where
T: Clone,
{
fn clone(&self) -> Self {
Self {
owner: self.owner.clone(),
hash: self.hash,
}
}
}

impl<T> Hashable for CacheHash<T>
where
T: Hashable,
Expand Down
Loading

0 comments on commit 67c8faf

Please sign in to comment.