aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-18 21:25:49 -0700
committerAdam Soltys <[email protected]>2026-08-18 21:25:49 -0700
commit16a9e78080554774d8fec8a4f29d19f97fa3722a (patch)
treee2ae899dcf620ef198ba690e9b7373fc0e5123c8
parentf538229a2bfca83309499e34533ad22acde551db (diff)
downloadcoinosv3-16a9e78080554774d8fec8a4f29d19f97fa3722a.tar.gz
coinosv3-16a9e78080554774d8fec8a4f29d19f97fa3722a.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.js7
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 });