aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ark/refresh-test.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-07 08:21:41 -0700
committerAdam Soltys <[email protected]>2026-10-07 08:21:41 -0700
commitbba8280a241ce86b0f372818d7aca85073d8e53a (patch)
tree9fa806951bf81e394cc67264eb605a3546eaca8c /tools/ark/refresh-test.js
parent52a39d014c03cdcc733ddc91af9d7acfee2ff27a (diff)
downloadcoinosv3-bba8280a241ce86b0f372818d7aca85073d8e53a.tar.gz
coinosv3-bba8280a241ce86b0f372818d7aca85073d8e53a.zip
ark board/refresh tests: current regtest chain and server rules
- mine/fund through the bc container (the standalone :18543 node was retired in the July consolidation) - board-test hands the server the funding tx (require_board_funding_tx) and waits for esplora to see the board confirmed: bark silently drops a received vtxo whose board tx it can't find yet - refresh-test rounds the ppm fee up like the server (and the manager) do Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'tools/ark/refresh-test.js')
-rw-r--r--tools/ark/refresh-test.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/ark/refresh-test.js b/tools/ark/refresh-test.js
index f23ee05..0557659 100644
--- a/tools/ark/refresh-test.js
+++ b/tools/ark/refresh-test.js
@@ -26,11 +26,10 @@ import {
cosignHarkLeaf, requestForfeitNonces, forfeitBundle, forfeitVtxos,
encodeVtxoFromDecoded,
} from '../../src/ark/refresh.js';
+import { ALICE, aliceReady } from './alice.js';
const ARK = process.env.ARK_URL || 'http://127.0.0.1:3535';
-const BARK = `${process.env.HOME}/bark/target/debug/bark`;
-const ALICE = `${BARK} --datadir ${process.env.HOME}/ark-regtest/alice`;
-const BCLI = `bitcoin-cli -regtest -datadir=${process.env.HOME}/ark-regtest/bitcoind -rpcport=18543 -rpcwallet=miner`;
+const BCLI = `docker exec bc bitcoin-cli -rpcwallet=coinos`;
const FUND_SAT = 12345;
const SPEND_SAT = 3000;
@@ -51,6 +50,7 @@ const blinded = blindMailboxId(keys.mailbox.pubkey, hex.decode(info.mailboxPubke
const addr = encodeAddress({
testnet: true, serverPubkey: serverPub, userPubkey: keys.vtxo.pubkey, blindedMailboxId: blinded,
});
+await aliceReady();
execSync(`${ALICE} -q send ${addr} "${FUND_SAT} sat"`, { stdio: 'ignore' });
let input = null;
for (let i = 0; i < 10 && !input; i++) {
@@ -67,7 +67,7 @@ console.log(`input vtxo: ${input.id} (${input.amountSat} sat, expiry ${input.exp
const tipNow = Number(execSync(`${BCLI} getblockcount`).toString().trim());
const expiryBlocks = input.expiryHeight - tipNow;
const entry = info.refreshFees.ppmExpiryTable.filter((e) => e.thresholdBlocks <= expiryBlocks).pop();
-const fee = info.refreshFees.baseFeeSat + Math.floor((input.amountSat * (entry?.ppm ?? 0)) / 1_000_000);
+const fee = info.refreshFees.baseFeeSat + Math.ceil((input.amountSat * (entry?.ppm ?? 0)) / 1_000_000); // server rounds the ppm part up
const outputs = [{ amountSat: input.amountSat - fee, userPubkey: keys.vtxo.pubkey }];
console.log(`refresh fee: ${fee} sat (ppm ${entry?.ppm}, ${expiryBlocks} blocks to expiry) -> requesting ${outputs[0].amountSat} sat`);