diff options
| author | Adam Soltys <[email protected]> | 2026-08-18 21:25:49 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-18 21:25:49 -0700 |
| commit | 22f7e0ad8c4f41019d817b7b7bfb08c83eba55cb (patch) | |
| tree | 83ab159541734d05fba0c835e1c6979925e5014f | |
| parent | b87e5c4d800e9ba99b039afab8aa4dd743b06bfe (diff) | |
| download | coinosv3-server-22f7e0ad8c4f41019d817b7b7bfb08c83eba55cb.tar.gz coinosv3-server-22f7e0ad8c4f41019d817b7b7bfb08c83eba55cb.zip | |
The float sips instead of gulping: top-ups arrive in pool-sized chunks that accumulate to the target, sparing the ask that dies whole on a thin vtxo pool
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012u4oe1KPx9faCsDBLfZYqi
| -rw-r--r-- | names/server.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/names/server.js b/names/server.js index 298240b..12e1023 100644 --- a/names/server.js +++ b/names/server.js @@ -425,7 +425,10 @@ async function settleLoop() { // never sees). The refill that works is a circular route: out one channel to // a peer, straight back in on another, arriving as a real HTLC the ASP // intercepts. Costs the peer's forwarding fee (well under 1%). -const TOPUP = { lowWaterSat: 100_000, targetSat: 500_000, ...(CFG.floatTopup || {}) }; +// chunkSat caps one attempt: an ASP receive is funded from the vtxo pool, +// and asking for more than its fresh buckets hold fails whole ("vtxo pool is +// empty") where two smaller asks would land. Ticks accumulate to the target. +const TOPUP = { lowWaterSat: 100_000, targetSat: 500_000, chunkSat: 200_000, ...(CFG.floatTopup || {}) }; let topupCoolUntil = 0; async function autoTopupFloat() { if (!fwd || !ln || Date.now() < topupCoolUntil) return; @@ -448,7 +451,7 @@ async function autoTopupFloat() { } } if (!pick || pick.cap < 20_000) { log('float top-up: no circular route capacity'); return; } - const amountSat = Math.min(Math.max(TOPUP.targetSat, queuedSat + TOPUP.lowWaterSat) - floatSat, pick.cap); + const amountSat = Math.min(Math.max(TOPUP.targetSat, queuedSat + TOPUP.lowWaterSat) - floatSat, pick.cap, TOPUP.chunkSat); const a = await fwd.createLnInvoice(amountSat, 'float auto top-up'); const dec = await ln.call('decode', { string: a.invoice }); const gossip = await ln.call('listchannels', { short_channel_id: pick.back.short_channel_id }); |
