Database integrity check
Create a script, API or report that checks fiscal tickets integrity. It is an incremental check.
That is for each chain:
- For new chains check that the first ticket is number 1 (0 is EOS)
- For further checks, start at the last checked ticket and check if the signature wasn't changed
- Check that the following ticket signatures are OK and their number is n + 1
- Check that the signature of the EOS (end of sequence) ticket is OK
The result should give the list of errors and the last signature (before EOS). This signature is passed to the next check to see if the hole chain wasn't alterated between 2 checks and allow to recheck only this one instead of the whole chain again. This allow fast and frequent checks.
The whole chain must be checked on fiscal control. It will be resource and time consuming.