fix(pairing): default bunker_relay to the spire's public event relay, not localhost
Some checks failed
ci.yml / fix(pairing): default bunker_relay to the spire's public event relay, not localhost (pull_request) Failing after 0s
Some checks failed
ci.yml / fix(pairing): default bunker_relay to the spire's public event relay, not localhost (pull_request) Failing after 0s
The seed minted via the Pair UI baked an unreachable bunker relay into bunker_url. The UI form has no bunker_relay field, so pair_spire fell back to its default `settings.lnbits_nsec_bunker_url` — which on a deployed instance is the INTERNAL relay lnbits uses to reach the co-located bunker (e.g. ws://127.0.0.1:5000/nostrrelay/demo). The remote ATM can't reach localhost, so connectNewSeed hangs -> BunkerTimeoutError "Signer Unreachable". (Flagged by bitspire on the demo; the localhost-relay /pair gotcha the coord thread called out.) Default bunker_relay to the spire's own public event relay (relays[0]) instead: the bunker lives on the same operator nostrrelay the spire publishes its events to, so that URL is machine-reachable. An explicit `bunker_relay` still overrides for split-relay deploys. An empty override now falls back to the same default rather than raising. Regression test: with no (or empty) bunker_relay, bunker_url embeds relays[0] and contains no 127.0.0.1. NOTE: relays[0] is a pragmatic default; whether the seed should carry multiple relays / be sourced from the operator's nostrclient relay is a follow-up.
This commit is contained in:
parent
d0d20b0f94
commit
b55fc8bc1c
2 changed files with 32 additions and 22 deletions
|
|
@ -218,17 +218,29 @@ def test_malformed_token_raises():
|
|||
_pair(bunker)
|
||||
|
||||
|
||||
def test_missing_relay_or_passphrase_raises():
|
||||
with pytest.raises(PairingError, match="LNBITS_NSEC_BUNKER_URL"):
|
||||
asyncio.run(
|
||||
def test_bunker_relay_defaults_to_spire_event_relay():
|
||||
"""No explicit bunker_relay -> the relay baked into bunker_url is the spire's
|
||||
own public event relay (relays[0]), NOT lnbits's internal bunker URL. This
|
||||
is the localhost-relay /pair gotcha: a UI-minted seed (the form has no
|
||||
bunker_relay field) must embed a machine-reachable relay, not ws://127.0.0.1.
|
||||
An empty bunker_relay falls back to the same default."""
|
||||
from urllib.parse import quote
|
||||
|
||||
for empty in (None, ""):
|
||||
result = asyncio.run(
|
||||
pair_spire(
|
||||
_machine(),
|
||||
relays=_RELAYS,
|
||||
admin_client=FakeBunker(),
|
||||
bunker_relay="",
|
||||
admin_client=FakeBunker(token_secret="s"), # pragma: allowlist secret
|
||||
bunker_relay=empty,
|
||||
keystore_passphrase=_PASSPHRASE,
|
||||
)
|
||||
)
|
||||
assert f"relay={quote(_RELAYS[0], safe='')}" in result.bunker_url
|
||||
assert "127.0.0.1" not in result.bunker_url
|
||||
|
||||
|
||||
def test_missing_relay_or_passphrase_raises():
|
||||
with pytest.raises(PairingError, match="PASSPHRASE"):
|
||||
asyncio.run(
|
||||
pair_spire(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue