From 50c53876a72f7c4e8581552863172430ab6ebe81 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Fri, 20 Sep 2024 13:38:58 +0200 Subject: [PATCH] router: add Cancelable flag to SendPaymentRequest --- router_client.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/router_client.go b/router_client.go index 5cc841d..053f7aa 100644 --- a/router_client.go +++ b/router_client.go @@ -284,6 +284,13 @@ type SendPaymentRequest struct { // AMP is set to true if the payment should be an AMP payment. AMP bool + + // If set, the payment loop can be interrupted by manually canceling + // the payment context, even before the payment timeout is reached. + // Note that the payment may still succeed after cancellation, as + // in-flight attempts can still settle afterward. Canceling will only + // prevent further attempts from being sent. + Cancelable bool } // InterceptedHtlc contains information about a htlc that was intercepted in @@ -403,6 +410,7 @@ func (r *routerClient) SendPayment(ctx context.Context, AllowSelfPayment: request.AllowSelfPayment, Amp: request.AMP, TimePref: request.TimePref, + Cancelable: request.Cancelable, } if request.MaxCltv != nil { rpcReq.CltvLimit = *request.MaxCltv