From b5f1bde60415bc64bee1836af3a3bb53a996bf35 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Thu, 21 Nov 2019 12:05:43 +0100 Subject: [PATCH] routing: add error var for pre-built route tried --- routing/payment_session.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/routing/payment_session.go b/routing/payment_session.go index 3b27db42..979b7a7a 100644 --- a/routing/payment_session.go +++ b/routing/payment_session.go @@ -1,7 +1,7 @@ package routing import ( - "fmt" + "errors" "github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/lnwire" @@ -12,6 +12,12 @@ import ( // to prevent an HTLC being failed if some blocks are mined while it's in-flight. const BlockPadding uint16 = 3 +var ( + // errPrebuiltRouteTried is returned when the single pre-built route + // failed and there is nothing more we can do. + errPrebuiltRouteTried = errors.New("pre-built route already tried") +) + // PaymentSession is used during SendPayment attempts to provide routes to // attempt. It also defines methods to give the PaymentSession additional // information learned during the previous attempts. @@ -66,7 +72,7 @@ func (p *paymentSession) RequestRoute(payment *LightningPayment, // If the pre-built route has been tried already, the payment session is // over. case p.preBuiltRoute != nil: - return nil, fmt.Errorf("pre-built route already tried") + return nil, errPrebuiltRouteTried } // Add BlockPadding to the finalCltvDelta so that the receiving node