MCPcopy Create free account
hub / github.com/subquery/subql / getHistoricalUnit

Function getHistoricalUnit

packages/node-core/src/utils/blocks.ts:57–66  ·  view source on GitHub ↗
(mode: HistoricalMode, header: Header)

Source from the content-addressed store, hash-verified

55}
56
57export function getHistoricalUnit(mode: HistoricalMode, header: Header): number {
58 if (mode === 'timestamp') {
59 if (!header.timestamp) {
60 throw new Error('Timestamp missing on current block header');
61 }
62 return header.timestamp.getTime();
63 }
64
65 return header.blockHeight;
66}

Callers 3

reindexFunction · 0.90
rewindMethod · 0.90
getHistoricalUnitMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected