Await for invoices using an absolute expiry
authorJeffrey Czyz <jkczyz@gmail.com>
Tue, 17 Oct 2023 14:59:39 +0000 (09:59 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Wed, 18 Oct 2023 23:32:46 +0000 (18:32 -0500)
commit11fb9c486b2ebbd57ed41ad92b91a7f92b55236a
treeb496bfa448b314b2f806379f987359e771cdbdc5
parent622f7f2f7943295ccf9393547390dc09852c8143
Await for invoices using an absolute expiry

PendingOutboundPayment::AwaitingInvoice counts the number of timer ticks
that have passed awaiting a Bolt12Invoice for an InvoiceRequest. When a
constant INVOICE_REQUEST_TIMEOUT_TICKS has passed, the payment is
forgotten. However, this mechanism is insufficient for the Refund
scenario, where the Refund's expiration should be used instead.

Change AwaitingInvoice to store an absolute expiry instead. When
removing stale payments, pass the `SystemTime` in `std` and the highest
block time minus two hours in `no-std`.
lightning/src/ln/channelmanager.rs
lightning/src/ln/outbound_payment.rs