Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ jobs:
run: |
uv run mypy .

- name: Run tests with pytest
- name: Run tests with pytest (with coverage & junit)
env:
UPSTREAM_BASE_URL: "http://test"
UPSTREAM_API_KEY: "test"
run: |
uv run pytest --verbose --tb=short
uv run pytest \
--verbose --tb=short \
--junitxml=pytest.xml \
--cov=routstr --cov-report=term

- name: Upload test results
if: always()
Expand Down
8 changes: 5 additions & 3 deletions routstr/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,20 @@ async def fetch_provider_health(endpoint_url: str) -> dict[str, Any]:
is_onion = ".onion" in endpoint_url

# Set up client arguments conditionally
proxies = None
proxies: dict[str, str] | None = None
if is_onion:
try:
tor_proxy = settings.tor_proxy_url
except Exception:
tor_proxy = "socks5://127.0.0.1:9050"
proxies = {"http://": tor_proxy, "https://": tor_proxy} # type: ignore[assignment]
proxies = {"http://": tor_proxy, "https://": tor_proxy}

async with httpx.AsyncClient(
timeout=httpx.Timeout(30.0),
follow_redirects=True,
proxies=proxies, # type: ignore[arg-type]
# NOTE: httpx < 0.28 supports the 'proxies' kwarg, 0.28+ removed it.
# We ignore the call-arg type here to keep compatibility across versions.
proxies=proxies, # type: ignore[call-arg]
) as client:
# Prefer provider's /v1/info for full details
info_url = f"{endpoint_url.rstrip('/')}/v1/info"
Expand Down
2 changes: 1 addition & 1 deletion routstr/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def recieve_token(
wallet = await get_wallet(token_obj.mint, token_obj.unit, load=False)
wallet.keyset_id = token_obj.keysets[0]

if token_obj.mint not in settings.cashu_mints:
if token_obj.mint.rstrip("/") not in [mint.rstrip("/") for mint in settings.cashu_mints]:
return await swap_to_primary_mint(token_obj, wallet)

wallet.verify_proofs_dleq(token_obj.proofs)
Expand Down
Loading