Skip to content
Merged
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
12 changes: 11 additions & 1 deletion src/livepeer_gateway/live_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
GetPaymentResponse,
LivePaymentSession,
_freeze_headers,
_payment_type_for_signer,
get_signer_info,
)

Expand Down Expand Up @@ -737,10 +738,19 @@ async def _get_runner_payment(
signer_url: str,
signer_headers: Optional[dict[str, str]],
) -> tuple[LivePaymentSession, GetPaymentResponse]:
# Scope/LV2V is a live-video job → always "lv2v". Every other runner (single-shot
# fal/tool caps) pays via the per-signer dual-path: legacy Daydream → "lv2v",
# modern signers → "byoc". The old hardcoded "live" was rejected by the Daydream
# signer ("invalid job type"), breaking LR payment on the default signer.
payment_type = (
"lv2v"
if runner is not None and runner.app == "live-video-to-video/scope"
else _payment_type_for_signer(signer_url)
)
session = LivePaymentSession(
signer_url=signer_url,
signer_headers=signer_headers,
type="lv2v" if runner is not None and runner.app == "live-video-to-video/scope" else "live",
type=payment_type,
payment_params=challenge.payment_params,
manifest_id=challenge.manifest_id,
orchestrator_url=challenge.orchestrator_url,
Expand Down
18 changes: 17 additions & 1 deletion src/livepeer_gateway/remote_signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
import ssl
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, Optional
from typing import Any, Literal, Optional
from urllib.error import HTTPError, URLError
from urllib.parse import urlparse
from urllib.request import Request, urlopen

import aiohttp
Expand All @@ -19,6 +20,21 @@
from .errors import LivepeerGatewayError, PaymentError, SignerRefreshRequired
_LOG = logging.getLogger(__name__)

_LEGACY_DAYDREAM_SIGNER_HOST = "signer.daydream.live"


def _payment_type_for_signer(signer_url: str) -> Literal["byoc", "lv2v"]:
"""Select the payment payload shape for the target signer.

Legacy Daydream signer (signer.daydream.live) accepts only type:"lv2v";
modern signers (pymthouse DMZ, …) accept type:"byoc". Shared by the BYOC and
Live Runner payment paths so both speak the dialect their signer understands.
"""
hostname = (urlparse(signer_url).hostname or "").lower()
if hostname == _LEGACY_DAYDREAM_SIGNER_HOST:
return "lv2v"
return "byoc"

@dataclass(frozen=True)
class GetPaymentResponse:
payment: str
Expand Down