A double check when counting/hashing

This commit is contained in:
Mike Dilger 2024-11-19 09:46:52 +13:00
parent f8d9be7c6d
commit beb9635e13
No known key found for this signature in database
GPG Key ID: 47581A78D4329BA4

View File

@ -77,7 +77,12 @@ impl FileStore {
});
// Copy the data into the tempfile (hashing and counting as we go)
tokio::io::copy(&mut inspect_reader, &mut tempfile).await?;
let count = tokio::io::copy(&mut inspect_reader, &mut tempfile).await?;
// Verify our code was correct
if count != size {
return Err(ChorusError::General("INTERNAL COUNT MISMATCH".to_string()).into());
}
// Finish the hash
let hash = HashOutput::from_engine(hash_engine);