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:
parent
8c06eb57c5
commit
d5cf6043e6
@ -24,6 +24,15 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/zpay32"
|
"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
|
// RouterBackend contains the backend implementation of the router rpc sub
|
||||||
// server calls.
|
// server calls.
|
||||||
type RouterBackend struct {
|
type RouterBackend struct {
|
||||||
@ -554,11 +563,12 @@ func (r *RouterBackend) extractIntentFromSendRequest(
|
|||||||
}
|
}
|
||||||
payIntent.CltvLimit = cltvLimit
|
payIntent.CltvLimit = cltvLimit
|
||||||
|
|
||||||
// Take max htlcs from the request. Map zero to one for backwards
|
// Attempt to parse the max parts value set by the user, if this value
|
||||||
// compatibility.
|
// isn't set, then we'll use the current default value for this
|
||||||
|
// setting.
|
||||||
maxParts := rpcPayReq.MaxParts
|
maxParts := rpcPayReq.MaxParts
|
||||||
if maxParts == 0 {
|
if maxParts == 0 {
|
||||||
maxParts = 1
|
maxParts = DefaultMaxParts
|
||||||
}
|
}
|
||||||
payIntent.MaxParts = maxParts
|
payIntent.MaxParts = maxParts
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user