aboutsummaryrefslogtreecommitdiffstats
path: root/names/server.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-14 00:44:28 -0700
committerAdam Soltys <[email protected]>2026-08-14 00:44:28 -0700
commitc6404bae2ddbc402baa01349c5196d9fcebcf78a (patch)
treecf470e1a68e2f9e1144b636aaca48c9c8e014b5e /names/server.js
parent8a75debb215a3e7a5697b1a5da7a9894222a290c (diff)
downloadcoinosv3-c6404bae2ddbc402baa01349c5196d9fcebcf78a.tar.gz
coinosv3-c6404bae2ddbc402baa01349c5196d9fcebcf78a.zip
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
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014tE4U5nEjGTQy8PwYqamfv
Diffstat (limited to 'names/server.js')
-rw-r--r--names/server.js12
1 files 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() {