routing+routerrpc+lncli: rename MaxHtlcs to MaxShards
This commit is contained in:
10 files changed
+147
-147
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(maxHtlcs uint32) ([]htlcAttempt,
|
||||
func (c *integratedRoutingContext) testPayment(maxShards uint32) ([]htlcAttempt,
|
||||
error) {
|
||||
|
||||
var (
|
||||
@@ -137,7 +137,7 @@ func (c *integratedRoutingContext) testPayment(maxHtlcs uint32) ([]htlcAttempt,
|
||||
DestFeatures: lnwire.NewFeatureVector(mppFeatures, nil),
|
||||
Amount: c.amt,
|
||||
CltvLimit: math.MaxUint32,
|
||||
MaxHtlcs: maxHtlcs,
|
||||
MaxShards: maxShards,
|
||||
}
|
||||
|
||||
session := &paymentSession{
|
||||
|
||||
@@ -85,7 +85,7 @@ type mppSendTestCase struct {
|
||||
|
||||
graph func(g *mockGraph)
|
||||
expectedFailure bool
|
||||
maxHtlcs uint32
|
||||
maxShards uint32
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -150,7 +150,7 @@ var mppTestCases = []mppSendTestCase{
|
||||
chans: []uint64{chanSourceIm2, chanIm2Target},
|
||||
},
|
||||
},
|
||||
maxHtlcs: 1000,
|
||||
maxShards: 1000,
|
||||
},
|
||||
|
||||
// Test that a cap on the max htlcs makes it impossible to pay.
|
||||
@@ -161,7 +161,7 @@ var mppTestCases = []mppSendTestCase{
|
||||
expectedAttempts: 2,
|
||||
expectedSuccesses: []expectedHtlcSuccess{},
|
||||
expectedFailure: true,
|
||||
maxHtlcs: 1,
|
||||
maxShards: 1,
|
||||
},
|
||||
|
||||
// Test that an attempt is made to split the payment in multiple parts
|
||||
@@ -186,7 +186,7 @@ var mppTestCases = []mppSendTestCase{
|
||||
},
|
||||
},
|
||||
expectedFailure: true,
|
||||
maxHtlcs: 1000,
|
||||
maxShards: 1000,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ func testMppSend(t *testing.T, testCase *mppSendTestCase) {
|
||||
|
||||
ctx.amt = lnwire.NewMSatFromSatoshis(testCase.amt)
|
||||
|
||||
attempts, err := ctx.testPayment(testCase.maxHtlcs)
|
||||
attempts, err := ctx.testPayment(testCase.maxShards)
|
||||
switch {
|
||||
case err == nil && testCase.expectedFailure:
|
||||
t.Fatal("expected payment to fail")
|
||||
|
||||
@@ -211,7 +211,7 @@ func (p *paymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi,
|
||||
switch {
|
||||
case err == errNoPathFound:
|
||||
// No splitting if this is the last shard.
|
||||
isLastShard := activeShards+1 >= p.payment.MaxHtlcs
|
||||
isLastShard := activeShards+1 >= p.payment.MaxShards
|
||||
if isLastShard {
|
||||
return nil, errNoPathFound
|
||||
}
|
||||
|
||||
+3
-3
@@ -1625,9 +1625,9 @@ type LightningPayment struct {
|
||||
// fail.
|
||||
DestCustomRecords record.CustomSet
|
||||
|
||||
// MaxHtlcs is the maximum number of partial payments that may be use to
|
||||
// complete the full amount.
|
||||
MaxHtlcs uint32
|
||||
// MaxShards is the maximum number of partial payments that may be used
|
||||
// to complete the full amount.
|
||||
MaxShards uint32
|
||||
}
|
||||
|
||||
// SendPayment attempts to send a payment as described within the passed
|
||||
|
||||
Reference in new issue
Block a user