From c6404bae2ddbc402baa01349c5196d9fcebcf78a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 14 Aug 2026 00:44:28 -0700 Subject: Sub-sat routes round back up: a zero quote just fails its first attempt and pays 1 sat on retry anyway — true free needs the ASP to bring the msats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_014tE4U5nEjGTQy8PwYqamfv --- names/server.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/names/server.js b/names/server.js index 976fe60..2bfab2a 100644 --- a/names/server.js +++ b/names/server.js @@ -210,11 +210,13 @@ const ln = CFG.ln ? lnBackend(CFG.ln) : null; // -- routing-fee quotes (the /lnquote endpoint) ------------------------------ -// Sub-sat route fees round DOWN to a free quote: Ark locks are sat-granular, -// and captaind passes a 0 maxfee as an absent proto field, so xpay falls back -// to its default ~1% cap and the ASP absorbs the msats (which land on our own -// node whenever the route goes through it). Anything >= 1 sat rounds up. -const quoteSat = (msat) => (msat < 1000 ? 0 : Math.ceil(msat / 1000)); +// Ark locks are sat-granular and the locked surplus IS xpay's maxfee, which +// binds hard — a 9 msat route under a 0 budget fails outright (verified live: +// "Could not find route without excessive cost", then the +1-sat retry paid). +// So sub-sat fees round UP: the honest minimum a client can bring is 1 sat. +// Making those truly free needs the ASP to bring the msats itself (captaind +// patch: floor max_routing_fee at 1 sat), not a rounder-down here. +const quoteSat = (msat) => Math.ceil(msat / 1000); let _ourNodeId = null; async function ourNodeId() { -- cgit v1.2.3