lnurl balanceCheck and balanceNotify.

This commit is contained in:
fiatjaf
2021-04-17 23:21:19 -03:00
parent f08d86c6df
commit efd9c6917f
9 changed files with 303 additions and 43 deletions
+10
View File
@@ -9,7 +9,9 @@ from lnbits.core.crud import (
get_payments,
get_standalone_payment,
delete_expired_invoices,
get_balance_checks,
)
from lnbits.core.services import redeem_lnurl_withdraw
main_app: Optional[QuartTrio] = None
@@ -93,6 +95,14 @@ async def check_pending_payments():
await trio.sleep(60 * 30) # every 30 minutes
async def perform_balance_checks():
while True:
for bc in await get_balance_checks():
redeem_lnurl_withdraw(bc.wallet, bc.url)
await trio.sleep(60 * 60 * 6) # every 6 hours
async def invoice_callback_dispatcher(checking_id: str):
payment = await get_standalone_payment(checking_id)
if payment and payment.is_in: