routing+routerrpc: rename max_shards to max_parts
Don't introduce a new term and align with the P in MPP.
This commit is contained in:
11 files changed
+169
-169
No files matched your search
@@ -88,7 +88,7 @@ func (h htlcAttempt) String() string {
|
||||
|
||||
// testPayment launches a test payment and asserts that it is completed after
|
||||
// the expected number of attempts.
|
||||
func (c *integratedRoutingContext) testPayment(maxShards uint32) ([]htlcAttempt,
|
||||
func (c *integratedRoutingContext) testPayment(maxParts uint32) ([]htlcAttempt,
|
||||
error) {
|
||||
|
||||
var (
|
||||
@@ -137,7 +137,7 @@ func (c *integratedRoutingContext) testPayment(maxShards uint32) ([]htlcAttempt,
|
||||
DestFeatures: lnwire.NewFeatureVector(mppFeatures, nil),
|
||||
Amount: c.amt,
|
||||
CltvLimit: math.MaxUint32,
|
||||
MaxShards: maxShards,
|
||||
MaxParts: maxParts,
|
||||
}
|
||||
|
||||
session, err := newPaymentSession(
|
||||
|
||||
@@ -85,7 +85,7 @@ type mppSendTestCase struct {
|
||||
|
||||
graph func(g *mockGraph)
|
||||
expectedFailure bool
|
||||
maxShards uint32
|
||||
maxParts uint32
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -152,7 +152,7 @@ var mppTestCases = []mppSendTestCase{
|
||||
chans: []uint64{chanSourceIm2, chanIm2Target},
|
||||
},
|
||||
},
|
||||
maxShards: 1000,
|
||||
maxParts: 1000,
|
||||
},
|
||||
|
||||
// Test that a cap on the max htlcs makes it impossible to pay.
|
||||
@@ -165,7 +165,7 @@ var mppTestCases = []mppSendTestCase{
|
||||
expectedAttempts: 2,
|
||||
expectedSuccesses: []expectedHtlcSuccess{},
|
||||
expectedFailure: true,
|
||||
maxShards: 1,
|
||||
maxParts: 1,
|
||||
},
|
||||
|
||||
// Test that an attempt is made to split the payment in multiple parts
|
||||
@@ -190,7 +190,7 @@ var mppTestCases = []mppSendTestCase{
|
||||
},
|
||||
},
|
||||
expectedFailure: true,
|
||||
maxShards: 1000,
|
||||
maxParts: 1000,
|
||||
},
|
||||
|
||||
// Test that no attempts are made if the total local balance is
|
||||
@@ -203,7 +203,7 @@ var mppTestCases = []mppSendTestCase{
|
||||
amt: 300000,
|
||||
expectedAttempts: 0,
|
||||
expectedFailure: true,
|
||||
maxShards: 10,
|
||||
maxParts: 10,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ func testMppSend(t *testing.T, testCase *mppSendTestCase) {
|
||||
|
||||
ctx.amt = lnwire.NewMSatFromSatoshis(testCase.amt)
|
||||
|
||||
attempts, err := ctx.testPayment(testCase.maxShards)
|
||||
attempts, err := ctx.testPayment(testCase.maxParts)
|
||||
switch {
|
||||
case err == nil && testCase.expectedFailure:
|
||||
t.Fatal("expected payment to fail")
|
||||
|
||||
@@ -263,11 +263,11 @@ func (p *paymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi,
|
||||
}
|
||||
|
||||
// No splitting if this is the last shard.
|
||||
isLastShard := activeShards+1 >= p.payment.MaxShards
|
||||
isLastShard := activeShards+1 >= p.payment.MaxParts
|
||||
if isLastShard {
|
||||
p.log.Debugf("not splitting because shard "+
|
||||
"limit %v has been reached",
|
||||
p.payment.MaxShards)
|
||||
p.payment.MaxParts)
|
||||
|
||||
return nil, errNoPathFound
|
||||
}
|
||||
|
||||
+2
-2
@@ -1625,9 +1625,9 @@ type LightningPayment struct {
|
||||
// fail.
|
||||
DestCustomRecords record.CustomSet
|
||||
|
||||
// MaxShards is the maximum number of partial payments that may be used
|
||||
// MaxParts is the maximum number of partial payments that may be used
|
||||
// to complete the full amount.
|
||||
MaxShards uint32
|
||||
MaxParts uint32
|
||||
}
|
||||
|
||||
// SendPayment attempts to send a payment as described within the passed
|
||||
|
||||
Reference in new issue
Block a user