More scalable data storage
This commit is contained in:
@@ -3,7 +3,7 @@ import { resolve } from 'node:path';
|
||||
import { stdin, stdout } from 'node:process';
|
||||
import { randomInt } from 'node:crypto';
|
||||
import { decryptWallet } from '../../shared/wallet-backup.ts';
|
||||
import { blockClaimMessage, NETWORK, type MiningTemplate, type TestnetBlock } from '../../shared/testnet.ts';
|
||||
import { blockClaimMessage, CONSENSUS, NETWORK, type MiningTemplate, type TestnetBlock } from '../../shared/testnet.ts';
|
||||
import { CHAIN_ID, sha256, miningBlob, mintId, blockSchema } from './consensus.ts';
|
||||
import { RandomX } from './randomx.ts';
|
||||
|
||||
@@ -83,7 +83,7 @@ try {
|
||||
header.nonce += 16;
|
||||
stdout.write(`\r${(attempts / ((Date.now()-started)/1000)).toFixed(1)} H/s · searching block #${header.height} `);
|
||||
const status = await api('/p2p/status');
|
||||
if (status.tip !== header.previousHash || Date.now()/1000 - header.createdAt > 60) { console.log('\nRefreshing stale work'); break; }
|
||||
if (status.tip !== header.previousHash || Date.now()/1000 - header.createdAt > CONSENSUS.targetSeconds * 2) { console.log('\nRefreshing stale work'); break; }
|
||||
// Explicit idle interval; native miner never starts with the web page.
|
||||
await new Promise(resolve => setTimeout(resolve,100));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user