This commit is contained in:
2026-10-19 21:47:38 -04:00
parent f8eeae826f
commit b1d2b5c10e
17 changed files with 549 additions and 92 deletions
+3 -2
View File
@@ -4,7 +4,8 @@ import { generateKeyPairSync, sign } from 'node:crypto';
import { setTimeout as delay } from 'node:timers/promises';
import { RandomX } from '../server/testnet/randomx.ts';
import { address, CHAIN_ID, miningBlob, mintId, sha256 } from '../server/testnet/consensus.ts';
import { blockClaimMessage, nftTransferMessage, NETWORK, testnetOwnerOf, type MiningTemplate, type TestnetSnapshot } from '../shared/testnet.ts';
import { blockClaimMessage, nftTransferMessage, NETWORK, testnetOwnerOf, transactionCardIds,
type MiningTemplate, type TestnetSnapshot } from '../shared/testnet.ts';
if(!process.argv.includes('--consent'))throw new Error('This test mines three blocks with a native CPU worker. Pass --consent explicitly. Disposable NFT rewards are not recoverable.');
const nodes=(process.env.WIKIDECK_SMOKE_NODES??'http://127.0.0.1:3101,http://127.0.0.1:3102,http://127.0.0.1:3103').split(',');
@@ -31,7 +32,7 @@ try {
await api(nodes[0],'/api/transfer',{...tx,publicKey,signature:signed(nftTransferMessage(tx))});
const pending=await api(nodes[0],'/api/state') as TestnetSnapshot;
assert.equal(testnetOwnerOf(pending,first),owner);
assert.ok(pending.pendingTransfers.some(t=>t.cardHash===first));
assert.ok(pending.pendingTransfers.some(t=>transactionCardIds(t).includes(first)));
}
const template=await api(nodes[0],'/api/mining/template',{owner,publicKey}) as MiningTemplate;
let found;