Changed api to check lnurl exists and checking hash sent
This commit is contained in:
parent
ddb277ff92
commit
fa383ced1c
|
@ -118,11 +118,17 @@ async def create_hash_check(
|
|||
),
|
||||
)
|
||||
hashCheck = await get_hash_check(the_hash, lnurl_id)
|
||||
row = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,))
|
||||
return HashCheck.from_row(row) if row else None
|
||||
return hashCheck
|
||||
|
||||
|
||||
async def get_hash_check(the_hash: str, lnurl_id: str) -> Optional[HashCheck]:
|
||||
row = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,))
|
||||
|
||||
return HashCheck.from_row(row) if row else None
|
||||
rowid = await db.fetchone("SELECT * FROM hash_check WHERE id = ?", (the_hash,))
|
||||
rowlnurl = await db.fetchone("SELECT * FROM hash_check WHERE lnurl_id = ?", (the_hash,))
|
||||
if not rowlnurl:
|
||||
return {"lnurl": False, "hash": False}
|
||||
else:
|
||||
if not rowid:
|
||||
await create_hash_check(the_hash, lnurl_id)
|
||||
return {"lnurl": True, "hash": False}
|
||||
else:
|
||||
return {"lnurl": True, "hash": True}
|
|
@ -119,9 +119,4 @@ async def api_link_delete(link_id):
|
|||
@api_check_wallet_key("invoice")
|
||||
async def api_hash_retrieve(the_hash, lnurl_id):
|
||||
hashCheck = await get_hash_check(the_hash, lnurl_id)
|
||||
|
||||
if not hashCheck:
|
||||
hashCheck = await create_hash_check(the_hash, lnurl_id)
|
||||
return jsonify({"status": False}), HTTPStatus.OK
|
||||
|
||||
return jsonify({"status": True}), HTTPStatus.OK
|
||||
return jsonify(hashCheck), HTTPStatus.OK
|
Loading…
Reference in New Issue
Block a user