Merge pull request #4924 from champo/check_payreq_multipart
routerrpc,routing: limit max parts if the invoice doesn't declare MPP support
This commit is contained in:
commit
301f1a870e
@ -648,6 +648,10 @@ func (r *RouterBackend) extractIntentFromSendRequest(
|
|||||||
payIntent.Amount = *payReq.MilliSat
|
payIntent.Amount = *payReq.MilliSat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !payReq.Features.HasFeature(lnwire.MPPOptional) {
|
||||||
|
payIntent.MaxParts = 1
|
||||||
|
}
|
||||||
|
|
||||||
copy(payIntent.PaymentHash[:], payReq.PaymentHash[:])
|
copy(payIntent.PaymentHash[:], payReq.PaymentHash[:])
|
||||||
destKey := payReq.Destination.SerializeCompressed()
|
destKey := payReq.Destination.SerializeCompressed()
|
||||||
copy(payIntent.Target[:], destKey)
|
copy(payIntent.Target[:], destKey)
|
||||||
|
@ -278,6 +278,12 @@ func (p *paymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi,
|
|||||||
return nil, errNoPathFound
|
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.
|
// No splitting if this is the last shard.
|
||||||
isLastShard := activeShards+1 >= p.payment.MaxParts
|
isLastShard := activeShards+1 >= p.payment.MaxParts
|
||||||
if isLastShard {
|
if isLastShard {
|
||||||
|
Loading…
Reference in New Issue
Block a user