Observer: logs the seeded checkpoint states at start and names the earlier state when a lock is recorded over one (index 1319 re-recorded 14 min after its lock at the 20:15 restart)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-labs 2026-10-04 20:19:59 +00:00
parent 66c0bf2a6d
commit 0d51aafee7

View file

@ -563,7 +563,12 @@ async function finalityTick(rpc) {
checkpointStates.set(cp.index, cp.state);
if (cp.votesSeen !== undefined) checkpointDetailed.add(cp.index);
await upsertCheckpoint(cp);
if (changed && cp.state === 'locked' && prev !== 'locked') await recordLock(cp);
if (changed && cp.state === 'locked' && prev !== 'locked') {
// a lock recorded over a known earlier state is a revisit (4 October 2026, 20:15:59: index 1319, locked 14 min
// before, was recorded again right after a restart; this line says what the seed held for it)
if (prev !== undefined) log(`checkpoint ${cp.index}: locked after a seeded or earlier state '${prev}'`);
await recordLock(cp);
}
} else if (cp.state !== 'locked' && (cp.index % 1 === 0)) {
// vote counts move while a checkpoint is open: refresh it
await upsertCheckpoint(cp);
@ -894,6 +899,7 @@ async function seedFromDb() {
const st = await sql(`SELECT difficulty FROM ${TS} WHERE id = 1`);
const cps = await sql(`SELECT index, state FROM ${TC} WHERE updated_at > now() - interval '1 day'`);
for (const r of cps) checkpointStates.set(Number(r.index), r.state);
{ const by = {}; for (const r of cps) by[r.state] = (by[r.state] || 0) + 1; log(`seeded ${cps.length} checkpoint states: ${Object.entries(by).map(([k, v]) => `${k} ${v}`).join(', ') || 'none'}`); }
const certs = await sql(`SELECT index, hash FROM ${TX}`);
for (const r of certs) storedCerts.set(Number(r.index), r.hash);
// proving: keep polling the blocks of the last 10 minutes that are not fully paid, so a restart loses nothing