deleting expired invoices based on their actual expiry date.

also fixes a possible bug that could have caused pending outgoing
payments to be deleted and affecting the balance. probably never happened.
This commit is contained in:
fiatjaf
2020-09-02 11:10:48 -03:00
parent d2650d6e2c
commit 4447a48724
3 changed files with 28 additions and 13 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ from binascii import unhexlify
from lnbits import bolt11
from lnbits.core import core_app
from lnbits.core.services import create_invoice, pay_invoice
from lnbits.core.crud import delete_expired_invoices
from lnbits.decorators import api_check_wallet_key, api_validate_post_request
from lnbits.settings import WALLET
@@ -13,7 +14,7 @@ from lnbits.settings import WALLET
@api_check_wallet_key("invoice")
def api_payments():
if "check_pending" in request.args:
g.wallet.delete_expired_payments()
delete_expired_invoices()
for payment in g.wallet.get_payments(complete=False, pending=True):
if payment.is_uncheckable: