After we made the payment lifecycle reliable (https://github.com/lightningnetwork/lnd/pull/2761) a natural follow-up was to introduce a cancel payment API for payments. This would let a payment be attempted with a very high payment timeout, and pathfinding would run in the background until canceled, failure or success.
Related to https://github.com/lightningnetwork/lnd/issues/4518
After we made the payment lifecycle reliable (https://github.com/lightningnetwork/lnd/pull/2761) a natural follow-up was to introduce a
cancel payment
API for payments. This would let a payment be attempted with a very high payment timeout, and pathfinding would run in the background until canceled, failure or success.What needs to be done is to signal the payment lifecycle that the payment should be canceled, and handle this signal here with a new failure reason (could also reuse the timeout one): https://github.com/lightningnetwork/lnd/blob/cc37485432741194c7f59320d4807af03d9e4698/routing/payment_lifecycle.go#L189