mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-27 17:23:12 +02:00
fix last views api bug, thanks calle
This commit is contained in:
parent
8dbf64a0d0
commit
56b4b0cf43
@ -387,19 +387,13 @@ async def api_payments_sse(
|
|||||||
async def api_payment(payment_hash, X_Api_Key: Optional[str] = Header(None)):
|
async def api_payment(payment_hash, X_Api_Key: Optional[str] = Header(None)):
|
||||||
# We use X_Api_Key here because we want this call to work with and without keys
|
# We use X_Api_Key here because we want this call to work with and without keys
|
||||||
# If a valid key is given, we also return the field "details", otherwise not
|
# If a valid key is given, we also return the field "details", otherwise not
|
||||||
wallet = None
|
wallet = await get_wallet_for_key(X_Api_Key) if type(X_Api_Key) == str else None
|
||||||
try:
|
|
||||||
assert X_Api_Key is not None
|
# we have to specify the wallet id here, because postgres and sqlite return internal payments in different order
|
||||||
# TODO: type above is Optional[str] how can that have .extra?
|
# and get_standalone_payment otherwise just fetches the first one, causing unpredictable results
|
||||||
if X_Api_Key.extra:
|
|
||||||
logger.warning("No key")
|
|
||||||
except:
|
|
||||||
if X_Api_Key is not None:
|
|
||||||
wallet = await get_wallet_for_key(X_Api_Key)
|
|
||||||
payment = await get_standalone_payment(
|
payment = await get_standalone_payment(
|
||||||
payment_hash, wallet_id=wallet.id if wallet else None
|
payment_hash, wallet_id=wallet.id if wallet else None
|
||||||
) # we have to specify the wallet id here, because postgres and sqlite return internal payments in different order
|
)
|
||||||
# and get_standalone_payment otherwise just fetches the first one, causing unpredictable results
|
|
||||||
if payment is None:
|
if payment is None:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=HTTPStatus.NOT_FOUND, detail="Payment does not exist."
|
status_code=HTTPStatus.NOT_FOUND, detail="Payment does not exist."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user