From 90d0396819ddfbabb8b7f45e8fc3ac0992a6b014 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 7 Oct 2026 08:21:47 -0700 Subject: ark tests: shared aliceReady() keeps the bark funding wallet usable scheduled-refresh-test mines a whole vtxo lifetime, which expires alice's coins; every test run after it funded nothing (spendableSat 0) or was handed an expired coin (receive-test). The helper refreshes expired coins and boards more when alice runs low, and the funding tests call it before paying. Co-Authored-By: Claude Opus 5.5 --- tools/ark/scheduled-refresh-test.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'tools/ark/scheduled-refresh-test.js') diff --git a/tools/ark/scheduled-refresh-test.js b/tools/ark/scheduled-refresh-test.js index bb030c4..c406514 100644 --- a/tools/ark/scheduled-refresh-test.js +++ b/tools/ark/scheduled-refresh-test.js @@ -15,11 +15,10 @@ import { wordlist } from '@scure/bip39/wordlists/english'; import { HDKey } from '@scure/bip32'; import { ArkManager } from '../../src/ark/manager.js'; +import { ALICE, aliceReady } from './alice.js'; const ARK = process.env.ARK_URL || 'http://127.0.0.1:3535'; const ESPLORA = process.env.ESPLORA_URL || 'http://127.0.0.1:30002'; -const BARK = `${process.env.HOME}/bark/target/debug/bark`; -const ALICE = `${BARK} --datadir ${process.env.HOME}/ark-regtest/alice`; const BCLI = `docker exec bc bitcoin-cli -rpcwallet=coinos`; const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); @@ -44,18 +43,8 @@ const account = HDKey.fromMasterSeed(mnemonicToSeedSync(mnemonic)).derive("m/86' const mgr = await new ArkManager({ account, storage, arkUrl: ARK, esploraUrl: ESPLORA }).init(); // This test mines a coin's whole lifetime in step 5, which also expires the -// funding wallet's coins — an expired vtxo can be refreshed but not sent, so -// re-running against a chain that already ran it would fund nothing. -const fundingReady = () => { - const alice = JSON.parse(sh(`${ALICE} -q vtxos`)); - const tip = tipHeight(); - if (!alice.some((v) => v.expiry_height <= tip)) return; - console.log(' … refreshing the funding wallet\'s expired coins first'); - sh(`${ALICE} refresh --all >/dev/null`); - mine(3); - sh(`${ALICE} -q balance >/dev/null`); -}; -fundingReady(); +// funding wallet's coins — aliceReady() refreshes them on the next run. +await aliceReady(); const receive = async (sat) => { const before = mgr.balance().spendableSat; -- cgit v1.2.3