fix(pairing): retry all bunker admin RPCs past transient timeouts (#38)
Some checks failed
ci.yml / fix(pairing): retry all bunker admin RPCs past transient timeouts (#38) (pull_request) Failing after 0s

The get_key_tokens retry only covered an empty token list; a transient
NsecBunkerTimeoutError on any admin RPC still failed pairing with a 502 (seen
live on aio-demo: create_new_key and get_key_tokens both 15s-timed-out, then a
manual retry succeeded). Generalise to `_bunker_retry`, wrapping every admin
call in the pair_spire chain (create_new_key, ensure_policy, create_new_token,
get_key_tokens): a NsecBunkerTimeoutError (and, for get_key_tokens, an empty
list) is transient → retry with backoff; a NsecBunkerRpcError rejection or
misconfig is terminal → fail fast. create_new_key is replace-by-name and
ensure_policy reconciles idempotently, so retrying on timeout is safe.

Also: _validate_relay now rejects a host-less ws:// (mint was laxer than the
consumer's parseSpireSeed), and stale "nostrclient" comments in the pair UI +
a test are corrected to "transport relay".

229 tests pass (incl. timeout-retry + fail-fast-rejection coverage).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-07-02 15:30:55 +02:00
commit 2b90590104
4 changed files with 93 additions and 32 deletions

View file

@ -845,8 +845,8 @@ window.app = Vue.createApp({
this.pairDialog.durationHours = null
this.pairDialog.result = null
this.pairDialog.show = true
// Pre-fill with this lnbits' default relay (the nostrclient proxy
// endpoint derived from lnbits_baseurl). The operator can override or
// Pre-fill with this lnbits' default relay (the relay its nostr transport
// listens on, derived from lnbits_baseurl). The operator can override or
// clear it; if left blank the backend fills in the same default.
try {
const {data} = await LNbits.api.request('GET', `${API}/default-relay`)
@ -861,7 +861,7 @@ window.app = Vue.createApp({
.split(/[\s,]+/)
.map(s => s.trim())
.filter(Boolean)
// relays is optional — blank falls back to the nostrclient endpoint
// relays is optional — blank falls back to the transport relay
// server-side (the pre-filled default), so no client-side requirement.
const body = {}
if (relays.length) {