diff options
| author | Adam Soltys <[email protected]> | 2026-10-07 09:13:31 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-07 09:13:31 -0700 |
| commit | 95b72a73545cd2a3700b0e0866eee54e59d3b50e (patch) | |
| tree | 81cc50c71d5e6cb78beaa1a7f755a23691f8983f /tools/ark/scheduled-refresh-test.js | |
| parent | 3aff6e4cc9eb97fc0fa488f1f95001f69f24330a (diff) | |
| parent | df87bd84560fec4b085b6f0f4785b61502ffd480 (diff) | |
| download | coinosv3-95b72a73545cd2a3700b0e0866eee54e59d3b50e.tar.gz coinosv3-95b72a73545cd2a3700b0e0866eee54e59d3b50e.zip | |
Merge branch 'worktree-agent-a9ba2f8bea9a7dafc'
Diffstat (limited to 'tools/ark/scheduled-refresh-test.js')
| -rw-r--r-- | tools/ark/scheduled-refresh-test.js | 17 |
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; |
