mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-29 21:32:38 +02:00
round USD rate to satoshis.
This commit is contained in:
@@ -19,7 +19,7 @@ async def lnurl_response(item_id):
|
|||||||
return jsonify({"status": "ERROR", "reason": "Item disabled."})
|
return jsonify({"status": "ERROR", "reason": "Item disabled."})
|
||||||
|
|
||||||
rate = await get_fiat_rate(item.unit) if item.unit != "sat" else 1
|
rate = await get_fiat_rate(item.unit) if item.unit != "sat" else 1
|
||||||
price_msat = item.price * 1000 * rate
|
price_msat = int(item.price * rate) * 1000
|
||||||
|
|
||||||
resp = LnurlPayResponse(
|
resp = LnurlPayResponse(
|
||||||
callback=url_for("offlineshop.lnurl_callback", item_id=item.id, _external=True),
|
callback=url_for("offlineshop.lnurl_callback", item_id=item.id, _external=True),
|
||||||
@@ -43,8 +43,8 @@ async def lnurl_callback(item_id):
|
|||||||
else:
|
else:
|
||||||
rate = await get_fiat_rate(item.unit)
|
rate = await get_fiat_rate(item.unit)
|
||||||
# allow some fluctuation (the fiat price may have changed between the calls)
|
# allow some fluctuation (the fiat price may have changed between the calls)
|
||||||
min = rate * 995 * item.price
|
min = int(rate * item.price) * 995
|
||||||
max = rate * 1010 * item.price
|
max = int(rate * item.price) * 1010
|
||||||
|
|
||||||
amount_received = int(request.args.get("amount"))
|
amount_received = int(request.args.get("amount"))
|
||||||
if amount_received < min:
|
if amount_received < min:
|
||||||
|
Reference in New Issue
Block a user