Fix inconsequential mix of index and journal consts/functions

This commit is contained in:
Neil Macneale IV
2025-11-14 13:10:46 -08:00
parent b5a5f624fe
commit 8692ab290b

View File

@@ -237,7 +237,7 @@ func validateJournalRecord(buf []byte) error {
off, len(buf))
}
off -= indexRecChecksumSz
off -= journalRecChecksumSz
crcMatches := crc(buf[:off]) == readUint32(buf[off:])
if !crcMatches {
return fmt.Errorf("invalid journal record: CRC checksum does not match")
@@ -380,7 +380,8 @@ func peekRootHashAt(journal io.ReaderAt, offset int64) (root hash.Hash, err erro
return
}
buf = buf[:sz]
if !validateIndexRecord(buf) {
err = validateJournalRecord(buf)
if err != nil {
err = fmt.Errorf("failed to validate root hash record at %d", offset)
return
}