mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-20 05:42:18 +02:00
refactor: simplify logic
This commit is contained in:
parent
b89e30896f
commit
a7c72577cf
@ -200,15 +200,17 @@ 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 payment and payment.is_in:
|
if not payment or payment.is_out:
|
||||||
status = await payment.check_status()
|
return
|
||||||
payment.fee = status.fee_msat or 0
|
|
||||||
# only overwrite preimage if status.preimage provides it
|
status = await payment.check_status()
|
||||||
payment.preimage = status.preimage or payment.preimage
|
payment.fee = status.fee_msat or 0
|
||||||
payment.status = PaymentState.SUCCESS
|
# only overwrite preimage if status.preimage provides it
|
||||||
await update_payment(payment)
|
payment.preimage = status.preimage or payment.preimage
|
||||||
internal = "internal" if is_internal else ""
|
payment.status = PaymentState.SUCCESS
|
||||||
logger.success(f"{internal} invoice {checking_id} settled")
|
await update_payment(payment)
|
||||||
for name, send_chan in invoice_listeners.items():
|
internal = "internal" if is_internal else ""
|
||||||
logger.trace(f"invoice listeners: sending to `{name}`")
|
logger.success(f"{internal} invoice {checking_id} settled")
|
||||||
await send_chan.put(payment)
|
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