From fdd24fc1d680dbad359776b11ed2af6af22ed4d0 Mon Sep 17 00:00:00 2001 From: Juan Pablo Civile Date: Fri, 15 Jan 2021 14:56:16 -0300 Subject: [PATCH 1/2] routerrpc: limit max parts if the invoice doesn't declare MPP support --- lnrpc/routerrpc/router_backend.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lnrpc/routerrpc/router_backend.go b/lnrpc/routerrpc/router_backend.go index 74775fc5..6bb5b8be 100644 --- a/lnrpc/routerrpc/router_backend.go +++ b/lnrpc/routerrpc/router_backend.go @@ -648,6 +648,10 @@ func (r *RouterBackend) extractIntentFromSendRequest( payIntent.Amount = *payReq.MilliSat } + if !payReq.Features.HasFeature(lnwire.MPPOptional) { + payIntent.MaxParts = 1 + } + copy(payIntent.PaymentHash[:], payReq.PaymentHash[:]) destKey := payReq.Destination.SerializeCompressed() copy(payIntent.Target[:], destKey) From f574c150aa21ede437f04d62fc748e724c6cf7bf Mon Sep 17 00:00:00 2001 From: Juan Pablo Civile Date: Fri, 15 Jan 2021 14:56:32 -0300 Subject: [PATCH 2/2] routing: limit max parts if the invoice doesn't declare MPP support --- routing/payment_session.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/routing/payment_session.go b/routing/payment_session.go index 2d7ef8bf..4b766d4c 100644 --- a/routing/payment_session.go +++ b/routing/payment_session.go @@ -278,6 +278,12 @@ func (p *paymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi, return nil, errNoPathFound } + if !p.payment.DestFeatures.HasFeature(lnwire.MPPOptional) { + p.log.Debug("not splitting because destination doesn't declare MPP") + + return nil, errNoPathFound + } + // No splitting if this is the last shard. isLastShard := activeShards+1 >= p.payment.MaxParts if isLastShard {