Fixed bug in expected chunk count.

This commit is contained in:
CalDescent 2021-07-03 18:42:42 +01:00
parent e46c735efa
commit 4b1de108d1

View File

@ -100,7 +100,7 @@ public class ArbitraryTransaction extends Transaction {
}
// Check expected length of chunk hashes
int chunkCount = arbitraryTransactionData.getSize() / DataFileChunk.CHUNK_SIZE;
int chunkCount = (int)Math.ceil((double)arbitraryTransactionData.getSize() / (double)DataFileChunk.CHUNK_SIZE);
int expectedChunkHashesSize = (chunkCount > 1) ? chunkCount * HASH_LENGTH : 0;
if (chunkHashes == null && expectedChunkHashesSize > 0) {
return ValidationResult.INVALID_DATA_LENGTH;