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/ln-e2e-test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/ark/ln-e2e-test.js') diff --git a/tools/ark/ln-e2e-test.js b/tools/ark/ln-e2e-test.js index 4d31b56..088dcb0 100644 --- a/tools/ark/ln-e2e-test.js +++ b/tools/ark/ln-e2e-test.js @@ -18,11 +18,10 @@ import { sha256 } from '@noble/hashes/sha256'; import { ArkManager } from '../../src/ark/manager.js'; import { lnReceiveFee } from '../../src/ark/lightning.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 CLC = 'docker exec clc lightning-cli --regtest'; const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); @@ -45,6 +44,7 @@ const account = HDKey.fromMasterSeed(mnemonicToSeedSync(mnemonic)).derive("m/86' const mgr = await new ArkManager({ account, storage, arkUrl: ARK, esploraUrl: ESPLORA }).init(); console.log('\n[0] fund manager from alice'); +await aliceReady(); sh(`${ALICE} -q send ${mgr.address()} "25000 sat"`); for (let i = 0; i < 10 && !mgr.balance().spendableSat; i++) { await mgr.sync(); await sleep(1500); } check('funded 25000 sat', mgr.balance().spendableSat === 25000, JSON.stringify(mgr.balance())); -- cgit v1.2.3 From df87bd84560fec4b085b6f0f4785b61502ffd480 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 7 Oct 2026 09:12:43 -0700 Subject: ln-e2e-test: wait for both CLN nodes to reach the chain tip before the hold receive Run right after tests that mine, cln-ark could trail by a block or two and the receive failed with final_incorrect_cltv_expiry. Co-Authored-By: Claude Opus 5.5 --- tools/ark/ln-e2e-test.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tools/ark/ln-e2e-test.js') diff --git a/tools/ark/ln-e2e-test.js b/tools/ark/ln-e2e-test.js index 088dcb0..f4b5856 100644 --- a/tools/ark/ln-e2e-test.js +++ b/tools/ark/ln-e2e-test.js @@ -99,6 +99,11 @@ check('alice +100 from tiny send', aliceAfter === aliceBefore + 100, `${aliceBef // --------------------------------------------------------------------------- console.log('\n[2] RECEIVE: clc pays a 4000-sat invoice minted by hal (hold flow)'); +// both CLN nodes must have caught up with blocks earlier tests mined, or the +// HTLC's cltv disagrees with the hold invoice (final_incorrect_cltv_expiry) +const tip = Number(sh('docker exec bc bitcoin-cli getblockcount')); +const synced = (node) => JSON.parse(sh(`docker exec ${node} lightning-cli --regtest getinfo`)).blockheight >= tip; +for (let i = 0; i < 40 && !(synced('clc') && synced('cln-ark')); i++) await sleep(500); const balBefore = mgr.balance().spendableSat; const recv = await mgr.createLnInvoice(4000, 'ark-e2e-receive'); console.log(' hal invoice:', recv.invoice.slice(0, 50) + '…'); -- cgit v1.2.3