mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-25 16:20:54 +02:00
fix: rever tasks logic
This commit is contained in:
parent
de5159ab55
commit
543b7ecb23
@ -200,23 +200,15 @@ async def invoice_callback_dispatcher(checking_id: str, is_internal: bool = Fals
|
|||||||
invoice_listeners from core and extensions.
|
invoice_listeners from core and extensions.
|
||||||
"""
|
"""
|
||||||
payment = await get_standalone_payment(checking_id, incoming=True)
|
payment = await get_standalone_payment(checking_id, incoming=True)
|
||||||
if not payment or payment.is_out:
|
if payment and payment.is_in:
|
||||||
return
|
status = await payment.check_status()
|
||||||
|
payment.fee = status.fee_msat or 0
|
||||||
status = await payment.check_status()
|
# only overwrite preimage if status.preimage provides it
|
||||||
if not status.success:
|
payment.preimage = status.preimage or payment.preimage
|
||||||
logger.warning(
|
payment.status = PaymentState.SUCCESS
|
||||||
f"Invoice '{checking_id}' is not settled yet, status: {status}. "
|
await update_payment(payment)
|
||||||
"Should never got here!"
|
internal = "internal" if is_internal else ""
|
||||||
)
|
logger.success(f"{internal} invoice {checking_id} settled")
|
||||||
return
|
for name, send_chan in invoice_listeners.items():
|
||||||
payment.fee = status.fee_msat or 0
|
logger.trace(f"invoice listeners: sending to `{name}`")
|
||||||
# only overwrite preimage if status.preimage provides it
|
await send_chan.put(payment)
|
||||||
payment.preimage = status.preimage or payment.preimage
|
|
||||||
payment.status = PaymentState.SUCCESS
|
|
||||||
await update_payment(payment)
|
|
||||||
internal = "internal" if is_internal else ""
|
|
||||||
logger.success(f"{internal} invoice {checking_id} settled")
|
|
||||||
for name, send_chan in invoice_listeners.items():
|
|
||||||
logger.trace(f"invoice listeners: sending to `{name}`")
|
|
||||||
await send_chan.put(payment)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user