routing: allow splitting for AMP or MPP

This commit is contained in:
Conner Fromknecht 2021-05-06 09:18:22 -07:00
parent b0949054e5
commit 8c404ade18
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7
3 changed files with 8 additions and 5 deletions

View File

@ -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,
}

View File

@ -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,

View File

@ -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
}