Chunk-piece length comparison fix (#55)

This commit is contained in:
Arifcan Balta 2023-12-13 20:53:27 +03:00 committed by GitHub
parent cc24623a82
commit 911bf3a0d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 24 deletions

View file

@ -82,9 +82,9 @@ impl Lengths {
if !(is_power_of_two(chunk_length as u64)) {
anyhow::bail!("chunk length {} is not a power of 2", chunk_length);
}
if chunk_length >= piece_length {
if chunk_length > piece_length {
anyhow::bail!(
"chunk length {} should be smaller than pice length {}",
"chunk length {} should be smaller than or equal to piece length {}",
chunk_length,
piece_length
);