diff options
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; |
