From ca0581bd0ae0b923f312b6ecc1fd31ff7753d93b Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 23 Nov 2026 23:29:33 -0700 Subject: coinosv3 pin 73bffd9 → 2cd42f8: the float runs the wallet code the app runs. "Test it and bring it up to speed" (Adam, 2026-11-24, after the depth-cap outage of f27c49c). The pin was from 2026-10-16; since then src/ark gained the exit-depth cap (read from the server, field 19) and the deep-refresh waiver (field 3 of the refresh fees), refunds that come back through the mailbox to any key the wallet handed out, orphan HTLC coins settled by the server's answer, a send input cap of 48 instead of 24, and refreshes no longer retired for an expired input. The opt-in parts (honorsExpired, lnOldestFirst, infoHint, custody tiers) stay off: names passes none of them. Every ArkManager method names calls keeps its signature. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the cap in the library, f27c49c's selection wrapper goes. Float upkeep now flattens the library's deepCoins() — depth ≥ 60, where the server waives the 300-sat base fee — in a round of their own (the waiver needs every input deep), on a 2-minute cadence while there are enough of them to make a round; coins nearing expiry go in the next one. Names logs it if the server ever stops publishing a cap. Checked offline against the live float state with the live server info: balance matches /health (248,956 spendable, 13,934 renewing); sends of 52 to 150,000 sat pick coins at depth ≤ 26, none capped; upkeep does nothing now (26 deep dust coins, 152 sat, can't make a round) and flattens the main 66,315-sat coin with them for 133 sat once its chain reaches depth 60 (59: nothing). names and bridge tests (25), public-feed-cache-test, and a parse of names, bridge, feed and translate pass. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VMan6Upic5L6MMJzkTn8zg --- names/server.js | 46 ++++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 28 deletions(-) (limited to 'names/server.js') diff --git a/names/server.js b/names/server.js index a7424f8..6bbec01 100644 --- a/names/server.js +++ b/names/server.js @@ -374,23 +374,13 @@ if (CFG.forwarder?.mnemonic) { // between syncs) lives there, and balance() only counts what state has seen. await fwd.sync().catch(() => {}); log(`forwarder ark wallet ready — float ${fwd.balance().spendableSat} sat, receive ${fwd.address().slice(0, 24)}…`); - // A float send never picks a coin at the server's exit-depth cap. Each - // arkoor hop adds one to a coin's depth and only a round flattens it; at - // the cap the ASP refuses every cosign. The float's wallet code (the - // coinosv3 submodule, from 10-16) predates its own cap check, so the - // smallest coin covering a send — a 13,661-sat change chain at depth 100 — - // was picked for every forward under 13,661 sat and refused, from - // 2026-11-24 00:09Z until this went out ("reports of missing deposits", - // Adam). floatUpkeep refreshes such coins; until that round settles they - // are just left out here. - const select = fwd._selectInputs.bind(fwd), free = fwd._free.bind(fwd); - let selecting = false; - fwd._free = (v, busy) => free(v, busy) && !(selecting && floatCapped(v)); - fwd._selectInputs = (...a) => { selecting = true; try { return select(...a); } finally { selecting = false; } }; + // The wallet code must know the server's exit-depth cap: a send from a coin + // at it is refused at the cosign. The submodule pinned from 10-16 didn't, + // and picked a 13,661-sat coin at depth 100 for every forward under that + // from 2026-11-24 00:09Z ("reports of missing deposits", Adam). Say so + // loudly if the server ever stops publishing it. + if (!fwd._capDepth?.()) log('forwarder: the ark server publishes no exit-depth cap — deep coins will not be skipped or flattened'); } -function floatDepth(v) { try { return fwd._decoded(v).genesis.length; } catch { return 0; } } -const floatDepthCap = () => fwd?.info?.maxVtxoExitDepth || 100; -function floatCapped(v) { return floatDepth(v) >= floatDepthCap(); } // Is this name's wallet on another network than this registrar's node? Then // nothing payable may be minted for it here: a mainnet offer for a mutinynet @@ -1006,28 +996,28 @@ async function floatUpkeep() { // 2026-09-16 (a large coin, swept two blocks after expiry) and blocked // every round after it const live = (v) => !(v.expiryHeight && v.expiryHeight <= tip); - // coins at or near the depth cap can't be sent (see floatCapped): flatten - // them as soon as they get there, not on the 30-minute expiry cadence. + // Deep coins first, in a round of their own: each arkoor hop adds one to a + // coin's depth, the server refuses to cosign one at its cap (100), and it + // waives the base fee on a refresh whose every input is at its waiver depth + // (60) — so flatten them there, for the ppm alone, long before the cap. // Deep dust rides along with a bigger deep coin; alone it can't make a round. - const deep = spendables.filter((v) => live(v) && floatDepth(v) >= floatDepthCap() - 8); + const deep = fwd.deepCoins().filter(live); const deepSat = deep.reduce((n, v) => n + v.amountSat, 0); - if (Date.now() - floatRefreshAt < (deepSat >= 330 ? 2 * 60_000 : 30 * 60_000)) return; + const deepWorth = deepSat - fwd.refreshFee(deep, tip) >= 330; + if (Date.now() - floatRefreshAt < (deepWorth ? 2 * 60_000 : 30 * 60_000)) return; const expiring = spendables.filter((v) => live(v) && v.expiryHeight && v.expiryHeight - tip < REFRESH_MARGIN_BLOCKS && v.amountSat >= 330); - const ids = new Set(expiring.map((v) => v.id)); - if (deepSat >= 330) for (const v of deep) ids.add(v.id); - if (!ids.size) return; + const coins = deepWorth ? deep : expiring; + if (!coins.length) return; floatRefreshAt = Date.now(); - const coins = spendables.filter((v) => ids.has(v.id)); const sat = coins.reduce((n, v) => n + v.amountSat, 0); - const nDeep = coins.filter((v) => floatDepth(v) >= floatDepthCap() - 8).length; - log(`float upkeep: refreshing ${coins.length} coins (${sat} sat; ${nDeep} at depth ≥ ${floatDepthCap() - 8}, ${expiring.length} nearing expiry)`); - await fwd.refresh([...ids]); + log(`float upkeep: refreshing ${coins.length} coins (${sat} sat) ${deepWorth ? `at exit depth ≥ ${fwd._waiverDepth() || fwd._capDepth() - 8}` : 'nearing expiry'}`); + await fwd.refresh(coins.map((v) => v.id)); log(`float upkeep: refresh submitted — float now ${fwd.balance().spendableSat} sat`); } // A float fed by many small receives can hold enough sats yet too many coins -// for one send (the 24-input cap in _selectInputs). Merge the smallest into +// for one send (the 48-input cap in _selectInputs). Merge the smallest into // one fresh round output; floatUpkeep also does it before a send has to fail. const CONSOLIDATE_AT = 64, CONSOLIDATE_MAX = 64, CONSOLIDATE_SMALL = 5000; let consolidating = false; -- cgit v1.2.3