lnrpc/routerrpc: use new default value of 16 for maxparts

In this commit, we raise the default value for the `MaxParts` field from
1 to 16. This change was motivated by the fact that many users either
forget, or don't even know this field is there in the first place. A
value of 16 was chosen rather arbitraliy (other than power of 2). In
the future, we should tune this value based on the expected number of
payment attempts for a given payment amount.
This commit is contained in:
Olaoluwa Osuntokun 2021-02-11 17:14:40 -08:00
parent 8c06eb57c5
commit d5cf6043e6
No known key found for this signature in database
GPG Key ID: 3BBD59E99B280306

@ -24,6 +24,15 @@ import (
"github.com/lightningnetwork/lnd/zpay32"
)
const (
// DefaultMaxParts is the default number of splits we'll possibly use
// for MPP when the user is attempting to send a payment.
//
// TODO(roasbeef): make this value dynamic based on expected number of
// attempts for given amount
DefaultMaxParts = 16
)
// RouterBackend contains the backend implementation of the router rpc sub
// server calls.
type RouterBackend struct {
@ -554,11 +563,12 @@ func (r *RouterBackend) extractIntentFromSendRequest(
}
payIntent.CltvLimit = cltvLimit
// Take max htlcs from the request. Map zero to one for backwards
// compatibility.
// Attempt to parse the max parts value set by the user, if this value
// isn't set, then we'll use the current default value for this
// setting.
maxParts := rpcPayReq.MaxParts
if maxParts == 0 {
maxParts = 1
maxParts = DefaultMaxParts
}
payIntent.MaxParts = maxParts