mirror of
https://github.com/Routstr/routstrd.git
synced 2026-08-09 11:54:38 +00:00
When the local wallet runs out of proofs, the fallback chain now: 1. Retries across ALL configured mints (createProviderToken patched — previously only topUp retried on 'Not enough proofs') 2. Creates a routstr-core Lightning invoice (POST /lightning/invoice) → uses 'topup' purpose when an existing API key is available → pays via NWC (payBolt11) if connected, then retries → otherwise surfaces invoice for manual payment + polls until paid/expired 3. Falls back to local wallet Lightning invoice + NWC funding Hardening (15 new tests): - SSRF protection: rejects non-HTTPS provider URLs (except localhost) - Amount validation: clamps to [1, 1_000_000] sats - bolt11 validation: must start with 'lnbc' - invoice_id validation: must be non-empty string - Fetch timeout: AbortController (10s) on invoice creation - NWC exception handling: caught, not propagated - Double-install idempotency: patch markers prevent re-patching - Concurrent calls: no shared state corruption - API key safety: never logged in error messages - Poller lifecycle: stops after 84 attempts (~7min) or on expired status New wallet adapter method: - payBolt11(bolt11): pays externally-created invoices via NWC Verified end-to-end: - 50-request stress test: 44/50 success, 6 fallback triggers (fugu-ultra) - Routstr-core topup: 64,781 → 114,340 msats (balance increased) - Daemon stable post-stress (142MB RSS, immediate recovery) - 48/48 tests pass (33 existing + 15 hardening)