verifyChainIntegrity

suspend fun verifyChainIntegrity(fromTs: Long? = null, toTs: Long? = null): ChainVerificationResult

Verify the integrity of the audit chain, reading at most VERIFY_PAGE_SIZE rows at a time.

When fromTs or toTs is given, the range resolves to the contiguous seq interval from the lowest to the highest seq among rows whose ts is inside the window, and that whole interval is verified. Rows inside the interval but outside the ts window are verified too, so a backward clock step cannot cause a false break.

Seed: when the verified interval starts at the lowest stored seq, the first row must link to the recorded prune point (prunedThroughHash, GENESIS if retention never pruned), so deleting the oldest rows breaks verification. A ranged interval that starts later cannot know its predecessor and seeds from its first row's own prevHash.

Pages are read without holding the record lock, so retention can prune between pages. When the prune point moved during the run, the whole verification runs once more from the start and that result is returned, even if retention moved again during the rerun.

Return

Verification result.

Parameters

fromTs

Optional start timestamp (inclusive).

toTs

Optional end timestamp (inclusive).