lnurlp: actually fix what the previous commit did not.

This commit is contained in:
fiatjaf 2020-11-03 19:47:13 -03:00
parent 8947358c80
commit 2e12c0ba3c

View File

@ -39,11 +39,14 @@ async def api_lnurl_callback(link_id):
return jsonify({"status": "ERROR", "reason": "LNURL-pay not found."}), HTTPStatus.OK return jsonify({"status": "ERROR", "reason": "LNURL-pay not found."}), HTTPStatus.OK
min, max = link.min, link.max min, max = link.min, link.max
rate = await get_fiat_rate(link.currency) if link.currency else 1000 rate = await get_fiat_rate(link.currency) if link.currency else 1
if link.currency: if link.currency:
# allow some fluctuation (as the fiat price may have changed between the calls) # allow some fluctuation (as the fiat price may have changed between the calls)
min = rate * 995 * link.min min = rate * 995 * link.min
max = rate * 1010 * link.max max = rate * 1010 * link.max
else:
min = link.min * 1000
max = link.max * 1000
amount_received = int(request.args.get("amount")) amount_received = int(request.args.get("amount"))
if amount_received < min: if amount_received < min: