Mainnet
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { NETWORK, type CanonicalPage, type TestnetBlock, type TestnetSnapshot, type TestnetSummary } from './testnet.ts';
|
||||
import { expectedChainIdentity } from './chain-identity.ts';
|
||||
|
||||
const MAX_PAGE_BYTES = 2 * 1024 * 1024;
|
||||
const MAX_HISTORY_BYTES = 64 * 1024 * 1024;
|
||||
@@ -45,7 +46,9 @@ export class StateClient {
|
||||
}
|
||||
private async summary(signal: AbortSignal) {
|
||||
const s = await this.json<TestnetSummary>('summary', signal);
|
||||
if (s.network !== NETWORK || s.algorithm !== 'RandomX' || !hex.test(s.chainId) || !hex.test(s.tip) || !hex.test(s.genesis) ||
|
||||
const expected = await expectedChainIdentity();
|
||||
if (s.network !== NETWORK || s.chainId !== expected.chainId || s.genesis !== expected.genesis ||
|
||||
s.algorithm !== 'RandomX' || !hex.test(s.chainId) || !hex.test(s.tip) || !hex.test(s.genesis) ||
|
||||
!Number.isSafeInteger(s.height) || s.height < 0 || !Array.isArray(s.pendingTransfers) || s.pendingTransfers.length > 256 ||
|
||||
!/^\d{1,256}$/.test(s.cumulativeWork)) throw new Error('Incompatible node summary.');
|
||||
if (s.height > MAX_CLIENT_BLOCKS) throw new Error('This node exceeds the browser history limit (10,000 blocks). A paged explorer/wallet is required; no partial ownership state will be shown.');
|
||||
|
||||
Reference in New Issue
Block a user