Files
Matt Hess 733ecd2681 Migrate all JS tests to Rust: 9-crate workspace, 703 tests, 0 JS remaining
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.
2026-02-17 23:09:35 +00:00

52 lines
1.5 KiB
JavaScript

#!/usr/bin/env bun
// Check block headers to understand tx distribution
import { createDaemonRPC } from '../src/rpc/index.js';
const daemon = createDaemonRPC({ url: 'http://seed01.salvium.io:19081', timeout: 30000 });
async function test() {
// Check a sample of blocks
const ranges = [
[1000, 1100],
[10000, 10100],
[50000, 50100],
[100000, 100100],
[200000, 200100],
[300000, 300100],
[400000, 400050]
];
for (const [start, end] of ranges) {
const headers = await daemon.getBlockHeadersRange(start, end);
let totalTxs = 0;
let blocksWithTxs = 0;
for (const h of headers.result?.headers || []) {
if (h.num_txes > 0) {
blocksWithTxs++;
totalTxs += h.num_txes;
}
}
console.log(`Blocks ${start}-${end}: ${blocksWithTxs} blocks with txs, ${totalTxs} total txs`);
}
// Get one specific block with transactions
console.log('\nLooking for a block with transactions...');
const headers = await daemon.getBlockHeadersRange(1000, 2000);
for (const h of headers.result?.headers || []) {
if (h.num_txes > 0) {
console.log(` Block ${h.height}: ${h.num_txes} txs, hash=${h.hash.slice(0, 16)}...`);
const block = await daemon.getBlock(h.hash);
console.log(` tx_hashes: ${block.result?.tx_hashes?.length || 0}`);
if (block.result?.tx_hashes?.length > 0) {
console.log(` First tx: ${block.result.tx_hashes[0]}`);
}
break;
}
}
}
test().catch(console.error);