Delete the combined file if has an incorrect hash after joining chunks together

This commit is contained in:
CalDescent 2021-12-19 18:33:22 +00:00
parent 553de5a873
commit 623470209f

View File

@ -355,6 +355,8 @@ public class ArbitraryDataReader {
}
// Ensure the complete hash matches the joined chunks
if (!Arrays.equals(arbitraryDataFile.digest(), digest)) {
// Delete the invalid file
arbitraryDataFile.delete();
throw new DataException("Unable to validate complete file hash");
}
// Ensure the file's size matches the size reported by the transaction (throws a DataException if not)