From 8c404ade188ddeb4933e49e17268c01695055d43 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Thu, 6 May 2021 09:18:22 -0700 Subject: [PATCH] routing: allow splitting for AMP or MPP --- lnrpc/routerrpc/router_backend.go | 5 +++-- lntest/itest/lnd_amp_test.go | 1 - routing/payment_session.go | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lnrpc/routerrpc/router_backend.go b/lnrpc/routerrpc/router_backend.go index 45ec0dfe..f6a70eba 100644 --- a/lnrpc/routerrpc/router_backend.go +++ b/lnrpc/routerrpc/router_backend.go @@ -696,7 +696,9 @@ func (r *RouterBackend) extractIntentFromSendRequest( payIntent.Amount = *payReq.MilliSat } - if !payReq.Features.HasFeature(lnwire.MPPOptional) { + if !payReq.Features.HasFeature(lnwire.MPPOptional) && + !payReq.Features.HasFeature(lnwire.AMPOptional) { + payIntent.MaxParts = 1 } @@ -765,7 +767,6 @@ func (r *RouterBackend) extractIntentFromSendRequest( ampFeatures := []lnrpc.FeatureBit{ lnrpc.FeatureBit_TLV_ONION_OPT, lnrpc.FeatureBit_PAYMENT_ADDR_OPT, - lnrpc.FeatureBit_MPP_OPT, lnrpc.FeatureBit_AMP_OPT, } diff --git a/lntest/itest/lnd_amp_test.go b/lntest/itest/lnd_amp_test.go index 092629a2..f503dba5 100644 --- a/lntest/itest/lnd_amp_test.go +++ b/lntest/itest/lnd_amp_test.go @@ -71,7 +71,6 @@ func testSendPaymentAMP(net *lntest.NetworkHarness, t *harnessTest) { Dest: net.Bob.PubKey[:], Amt: int64(paymentAmt), FinalCltvDelta: chainreg.DefaultBitcoinTimeLockDelta, - MaxParts: 10, TimeoutSeconds: 60, FeeLimitMsat: noFeeLimitMsat, Amp: true, diff --git a/routing/payment_session.go b/routing/payment_session.go index 893eb524..ebaef74d 100644 --- a/routing/payment_session.go +++ b/routing/payment_session.go @@ -296,9 +296,12 @@ func (p *paymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi, return nil, errNoPathFound } - if !p.payment.DestFeatures.HasFeature(lnwire.MPPOptional) { + destFeatures := p.payment.DestFeatures + if !destFeatures.HasFeature(lnwire.MPPOptional) && + !destFeatures.HasFeature(lnwire.AMPOptional) { + p.log.Debug("not splitting because " + - "destination doesn't declare MPP") + "destination doesn't declare MPP or AMP") return nil, errNoPathFound }