Index, probe, and announce LNURL mints in the API.

Wire discovery and probing for LNURL mints, add rate-limited POST /api/index
for user submissions, and optionally announce confirmed state to relays.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
michilis
2026-08-22 03:44:35 +02:00
co-authored by Cursor
parent c97b44018d
commit 2a9444942b
19 changed files with 4383 additions and 72 deletions
+15
View File
@@ -1,4 +1,5 @@
import { serve } from '@hono/node-server';
import { announceLnurlMints } from './announce.ts';
import { config } from './config.ts';
import { closeDb, getDb, pruneProbes } from './db.ts';
import { closePool, runDiscovery } from './discovery.ts';
@@ -31,6 +32,20 @@ async function probeCycle(): Promise<void> {
probeRunning = true;
try {
await track(probeAll());
/*
* Announcing runs after probing, in the same cycle, because it publishes only what
* the probe just confirmed — running it on its own timer would mean signing for a
* state that could be an interval old. Off by default; see `announceConfig`.
*
* Its own failures are caught here rather than allowed to mark the probe cycle
* failed: whether relays accepted an event says nothing about whether this site
* successfully checked its mints.
*/
await track(announceLnurlMints()).catch((err: unknown) => {
log.error('announce cycle failed', {
reason: err instanceof Error ? err.message : String(err),
});
});
} catch (err) {
log.error('probe cycle failed', { reason: err instanceof Error ? err.message : String(err) });
} finally {