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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user