routing: make payments loaded from disk timeout aware
As mentioned in this TODO, when we resume payments from the disk, we never time out the payment lifecycle, which could cause the payment stuck in flight. To solve it,
- Store timeout info to disk when creating the payment, a possible place would be
PaymentCreationInfo. - Modify
sendPaymentto use the timeout when we resume payments from the disk.
We may also need to sanity check the timeout value set by the user is not too small, causing unnecessary failures in routing payments.
As mentioned in this TODO,
Using a commit hash to link to the line as things have shifted so this isn't an accurate line number any more: https://github.com/lightningnetwork/lnd/blob/7dfe4018ce2f95c2f6a9ff04e370f668fc755138/routing/router.go#L1908
Is this still an issue of interest?
@MStreet3 yes. But this should be attempted after #7503.
This PR should also introduce the check that if payments are restarted but the invoice has already timed-out we do not attempt the payment and fail it immediately (see for more details: https://github.com/lightningnetwork/lnd/pull/7503#discussion_r1375211579)