aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-09 13:46:48 -0700
committerAdam Soltys <[email protected]>2026-08-09 13:46:48 -0700
commite784eca03f54631883022189d5c5ac7bbed7e562 (patch)
tree59c6352214238e45012d99644deccb10fe155584
parent5eee051ea1feeed4cb206f107961c18c3bf79f57 (diff)
downloadcoinosv3-server-e784eca03f54631883022189d5c5ac7bbed7e562.tar.gz
coinosv3-server-e784eca03f54631883022189d5c5ac7bbed7e562.zip
A stuck forward now holds its tongue: retries back off to an hour, and an offer knock reads as money arriving, not leaving
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01DbA53PJA8fgSvMcEzfuw22
-rw-r--r--names/server.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/names/server.js b/names/server.js
index 3ebfa48..9931cae 100644
--- a/names/server.js
+++ b/names/server.js
@@ -325,13 +325,22 @@ async function settleLoop() {
}
}
}
-// retry queued forwards (e.g. after the float is topped up)
+// retry queued forwards (e.g. after the float is topped up). Each failure
+// backs off exponentially (1m → 1h cap): a stuck forward must not fire an
+// offer request — and push-wake the recipient's devices — every minute
+// forever.
setInterval(async () => {
const q = state.pending || [];
if (!q.length || !fwd) return;
const still = [];
for (const p of q) {
- try { await forward(p.name, p.sat); } catch { still.push(p); }
+ if (p.next && Date.now() < p.next) { still.push(p); continue; }
+ try { await forward(p.name, p.sat); }
+ catch {
+ p.tries = (p.tries || 0) + 1;
+ p.next = Date.now() + Math.min(3_600_000, 60_000 * 2 ** Math.min(p.tries - 1, 6));
+ still.push(p);
+ }
}
state.pending = still;
persist();