Skip to content

Commit 272af2b

Browse files
AIQnetLabclaude
andcommitted
fix(explorer): use block timestamp for TX time, not per-TX field
Genesis bootstrap TXs (CreateAccount/registration/system) carry a config-time stamp set hours before the genesis block is minted; the prior "tx-level first" rule surfaced that as a wrong time on genesis rows. Prefer the consensus-bound, slot-anchored block timestamp; fall back to the per-TX field only when absent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 9366fb7 commit 272af2b

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

applications/qnet-explorer/frontend/lib/sync-service.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,15 @@ function transformTransaction(
255255
return null;
256256
}
257257

258-
// v3.53: Use TX-level timestamp first (most accurate), block timestamp as fallback
259-
// API returns timestamp on both block and individual TX objects
258+
// v3.54: the canonical time of a TX is the BLOCK timestamp (consensus-bound, slot-anchored =
259+
// genesis_ts + height*SLOT), NOT the per-TX `timestamp`. The per-TX field is a client/bootstrap-set
260+
// value: genesis bootstrap TXs (CreateAccount/NodeRegistration/system) carry a config-time stamp made
261+
// hours before the genesis block is minted, which the old "tx-level first" rule surfaced as a wrong
262+
// "16h ago" on genesis (live TXs happened to match block ts, so only genesis looked wrong). Prefer the
263+
// block timestamp; fall back to the per-TX field only when the block timestamp is absent.
264+
const blockTs = blockTimestamp || 0;
260265
const txTs = Number(tx.timestamp) || 0;
261-
const fallbackTs = blockTimestamp || 0;
262-
let rawTs = (txTs > 0 ? txTs : fallbackTs);
266+
let rawTs = (blockTs > 0 ? blockTs : txTs);
263267
if (!Number.isFinite(rawTs) || rawTs < 0) {
264268
warn('[Sync] Invalid timestamp, fallback to 0:', rawTs);
265269
rawTs = 0;

0 commit comments

Comments
 (0)