fix: stop updating internal invoices inside the listener unlike external one (#3984)
Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
This commit is contained in:
@@ -1744,11 +1744,10 @@ async def test_check_fiat_status_handles_internal_states(mocker: MockerFixture):
|
||||
amount=1000,
|
||||
fee=0,
|
||||
bolt11="bolt11",
|
||||
status=PaymentState.PENDING,
|
||||
status=PaymentState.SUCCESS,
|
||||
fiat_provider="stripe",
|
||||
extra={"fiat_checking_id": "stripe_checking_id"},
|
||||
),
|
||||
skip_internal_payment_notifications=True,
|
||||
)
|
||||
)
|
||||
assert queue_put.await_count == 1
|
||||
|
||||
|
||||
@@ -15,7 +15,12 @@ from lnbits.core.services import create_invoice, create_user_account, pay_invoic
|
||||
from lnbits.core.services.payments import update_wallet_balance
|
||||
from lnbits.exceptions import InvoiceError, PaymentError
|
||||
from lnbits.settings import Settings
|
||||
from lnbits.tasks import create_task, wait_for_paid_invoices
|
||||
from lnbits.tasks import (
|
||||
create_task,
|
||||
internal_invoice_listener,
|
||||
internal_invoice_queue,
|
||||
wait_for_paid_invoices,
|
||||
)
|
||||
from lnbits.wallets.base import PaymentResponse
|
||||
from lnbits.wallets.fake import FakeWallet
|
||||
|
||||
@@ -231,7 +236,15 @@ async def test_notification_for_internal_payment(
|
||||
):
|
||||
test_name = "test_notification_for_internal_payment"
|
||||
|
||||
# Drain stale items left by session-scoped fixtures (e.g. update_wallet_balance)
|
||||
while not internal_invoice_queue.empty():
|
||||
try:
|
||||
internal_invoice_queue.get_nowait()
|
||||
except asyncio.QueueEmpty:
|
||||
break
|
||||
|
||||
on_paid_mock = mocker.AsyncMock()
|
||||
create_task(internal_invoice_listener())
|
||||
create_task(wait_for_paid_invoices(test_name, on_paid_mock)())
|
||||
payment = await create_invoice(
|
||||
wallet_id=to_wallet.id,
|
||||
|
||||
@@ -2073,7 +2073,7 @@
|
||||
{
|
||||
"response_type": "json",
|
||||
"response": {
|
||||
"settled": true
|
||||
"state": "SETTLED"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -2155,8 +2155,15 @@
|
||||
]
|
||||
},
|
||||
"lndrest": {
|
||||
"description": "lndrest.py doesn't handle the 'failed' status for `get_invoice_status`",
|
||||
"get_invoice_status_endpoint": []
|
||||
"get_invoice_status_endpoint": [
|
||||
{
|
||||
"description": "error status",
|
||||
"response_type": "json",
|
||||
"response": {
|
||||
"state": "CANCELED"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"alby": {
|
||||
"description": "alby.py doesn't handle the 'failed' status for `get_invoice_status`",
|
||||
@@ -2243,13 +2250,6 @@
|
||||
"response_type": "json",
|
||||
"response": {}
|
||||
},
|
||||
{
|
||||
"description": "error status",
|
||||
"response_type": "json",
|
||||
"response": {
|
||||
"seetled": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "bad json",
|
||||
"response_type": "data",
|
||||
|
||||
Reference in New Issue
Block a user