733ecd2681
Add root Cargo workspace with 9 crates: salvium-crypto (extended), salvium-types, salvium-consensus, salvium-wallet, salvium-tx, salvium-rpc, salvium-miner (extended), salvium-cli, salvium-multisig. New modules: chain_state, block_weight, alt_chain, validation, offline signing, stake lifecycle, wallet sync/query/encryption/utxo, randomx utilities, and full multisig crate with CARROT support. Delete 188 JS test/helper/debug files; archive integration test scripts to test/legacy-js/ for live testnet use. Testnet integration tests (transfer, stake, burn, convert, sweep) remain as #[ignore]- gated Rust tests runnable with --ignored against a live daemon.
36 lines
899 B
JavaScript
36 lines
899 B
JavaScript
/**
|
|
* Child Process Worker for RandomX Hashing
|
|
*/
|
|
|
|
const workerId = parseInt(process.argv[2]);
|
|
const hashCount = parseInt(process.argv[3]);
|
|
|
|
// Dynamic import
|
|
const { randomx_init_cache, randomx_create_vm } = await import('../src/randomx/vendor/index.js');
|
|
|
|
// Initialize
|
|
const seedHash = new TextEncoder().encode('test seed');
|
|
const cache = randomx_init_cache(seedHash);
|
|
const vm = randomx_create_vm(cache);
|
|
|
|
const template = new Uint8Array(76);
|
|
const view = new DataView(template.buffer);
|
|
|
|
// Signal ready
|
|
process.send({ type: 'ready', workerId });
|
|
|
|
// Wait for start
|
|
process.on('message', (msg) => {
|
|
if (msg.type === 'start') {
|
|
const start = Date.now();
|
|
|
|
for (let i = 0; i < hashCount; i++) {
|
|
view.setUint32(39, i, true);
|
|
vm.calculate_hash(template);
|
|
}
|
|
|
|
const elapsed = Date.now() - start;
|
|
process.send({ type: 'done', workerId, hashCount, elapsed });
|
|
}
|
|
});
|