diff options
| author | Adam Soltys <[email protected]> | 2026-03-12 12:14:24 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-03-12 12:14:24 -0700 |
| commit | b98986c6bf639ba700b52cc6ad28d3e450b7e073 (patch) | |
| tree | eedf7a598c7748f4cdd2512631d59cfd7fe9161d | |
| parent | 4f2bf9387fe509243501938f3d1fb8a9aed14e93 (diff) | |
| download | coinos-server-b98986c6bf639ba700b52cc6ad28d3e450b7e073.tar.gz coinos-server-b98986c6bf639ba700b52cc6ad28d3e450b7e073.zip | |
don't renew dust
| -rw-r--r-- | lib/ark.ts | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -63,6 +63,8 @@ export const refreshArkWallet = async (force = false) => { ); const manager = new VtxoManager(w); + const provider = new RestArkProvider(config.ark.arkServerUrl); + const info = await provider.getInfo(); // Recover swept/expired VTXOs (with backoff on repeated failures) if (balance.recoverable > 0 && now >= recoverySkipUntil) { @@ -87,10 +89,11 @@ export const refreshArkWallet = async (force = false) => { const RENEWAL_THRESHOLD_MS = 60 * 60 * 1000; if (now >= renewalSkipUntil) { try { - const expiring = await manager.getExpiringVtxos(RENEWAL_THRESHOLD_MS); + const allExpiring = await manager.getExpiringVtxos(RENEWAL_THRESHOLD_MS); + const expiring = allExpiring.filter((v: any) => v.value > Number(info.dust)); if (expiring.length > 0) { const expiringTotal = expiring.reduce((s: number, v: any) => s + v.value, 0); - l("ark renewing", expiring.length, "expiring vtxos, total:", expiringTotal, "sats"); + l("ark renewing", expiring.length, "expiring vtxos, total:", expiringTotal, "sats (skipped", allExpiring.length - expiring.length, "dust)"); const txid = await withTimeout(manager.renewVtxos(), 60_000, "ark renewal"); l("ark renewed vtxos, txid:", txid); await logArkOp("renewal", { txid, vtxoCount: expiring.length, amount: expiringTotal }); @@ -112,8 +115,6 @@ export const refreshArkWallet = async (force = false) => { const confirmed = boardingUtxos.filter((u: any) => u.status?.confirmed); if (confirmed.length > 0) { - const provider = new RestArkProvider(config.ark.arkServerUrl); - const info = await provider.getInfo(); const ramps = new Ramps(w); // Try each boarding UTXO, freshest first, skipping known failures |
