mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 02:21:35 +00:00
Handle expired invoices that are in_flight
This commit is contained in:
parent
b9aaf9f1bc
commit
b1e9081ff8
@ -551,6 +551,21 @@ class LNNode:
|
||||
|
||||
if "invoice expired" in str(e):
|
||||
print(f"Order: {order.id}. INVOICE EXPIRED. Hash: {hash}")
|
||||
# An expired invoice can already be in-flight. Check.
|
||||
try:
|
||||
request = routerrpc.TrackPaymentRequest(
|
||||
payment_hash=bytes.fromhex(hash)
|
||||
)
|
||||
|
||||
for response in cls.routerstub.TrackPaymentV2(request):
|
||||
handle_response(response, was_in_transit=True)
|
||||
|
||||
except Exception as e:
|
||||
if "payment isn't initiated" in str(e):
|
||||
print(
|
||||
f"Order: {order.id}. The expired invoice had not been initiated. Hash: {hash}"
|
||||
)
|
||||
|
||||
lnpayment.status = LNPayment.Status.EXPIRE
|
||||
lnpayment.last_routing_time = timezone.now()
|
||||
lnpayment.in_flight = False
|
||||
|
Loading…
Reference in New Issue
Block a user