mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 14:22:37 +01:00
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
2 changed files with 10 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue