aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ark/scheduled-refresh-test.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-07 08:21:47 -0700
committerAdam Soltys <[email protected]>2026-10-07 08:21:47 -0700
commit90d0396819ddfbabb8b7f45e8fc3ac0992a6b014 (patch)
treeadb0aeb5e1919fb93838491168b2647160e88a07 /tools/ark/scheduled-refresh-test.js
parentbba8280a241ce86b0f372818d7aca85073d8e53a (diff)
downloadcoinosv3-90d0396819ddfbabb8b7f45e8fc3ac0992a6b014.tar.gz
coinosv3-90d0396819ddfbabb8b7f45e8fc3ac0992a6b014.zip
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 <[email protected]>
Diffstat (limited to 'tools/ark/scheduled-refresh-test.js')
-rw-r--r--tools/ark/scheduled-refresh-test.js17
1 files changed, 3 insertions, 14 deletions
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;