routing+routerrpc: rename PaymentAttemptPenalty to AttemptCost

Make field names consistent with the command line flag.
This commit is contained in:
Joost Jager committed 2020-09-08 14:07:56 +02:00
1 parent 751b02361e
commit 17a6175e8b
7 files changed
+23 -26

No files matched your search

+2 -2
View File
@@ -65,8 +65,8 @@ func newIntegratedRoutingContext(t *testing.T) *integratedRoutingContext {
},
pathFindingCfg: PathFindingConfig{
PaymentAttemptPenalty: 1000,
MinProbability: 0.01,
AttemptCost: 1000,
MinProbability: 0.01,
},
source: source,
+9 -11
View File
@@ -45,11 +45,10 @@ type pathFinder = func(g *graphParams, r *RestrictParams,
[]*channeldb.ChannelEdgePolicy, error)
var (
// DefaultPaymentAttemptPenalty is the virtual cost in path finding weight
// units of executing a payment attempt that fails. It is used to trade
// off potentially better routes against their probability of
// succeeding.
DefaultPaymentAttemptPenalty = lnwire.NewMSatFromSatoshis(100)
// DefaultAttemptCost is the default virtual cost in path finding of a
// failed payment attempt. It is used to trade off potentially better
// routes against their probability of succeeding.
DefaultAttemptCost = lnwire.NewMSatFromSatoshis(100)
// DefaultMinRouteProbability is the default minimum probability for routes
// returned from findPath.
@@ -315,11 +314,10 @@ type RestrictParams struct {
// PathFindingConfig defines global parameters that control the trade-off in
// path finding between fees and probabiity.
type PathFindingConfig struct {
// PaymentAttemptPenalty is the virtual cost in path finding weight
// units of executing a payment attempt that fails. It is used to trade
// off potentially better routes against their probability of
// succeeding.
PaymentAttemptPenalty lnwire.MilliSatoshi
// AttemptCost is the virtual cost in path finding of a failed
// payment attempt. It is used to trade off potentially better routes
// against their probability of succeeding.
AttemptCost lnwire.MilliSatoshi
// MinProbability defines the minimum success probability of the
// returned route.
@@ -644,7 +642,7 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig,
// probability.
tempDist := getProbabilityBasedDist(
tempWeight, probability,
int64(cfg.PaymentAttemptPenalty),
int64(cfg.AttemptCost),
)
// If there is already a best route stored, compare this
+3 -3
View File
@@ -2582,8 +2582,8 @@ func testProbabilityRouting(t *testing.T, p10, p11, p20, minProbability float64,
}
ctx.pathFindingConfig = PathFindingConfig{
PaymentAttemptPenalty: lnwire.NewMSatFromSatoshis(10),
MinProbability: minProbability,
AttemptCost: lnwire.NewMSatFromSatoshis(10),
MinProbability: minProbability,
}
path, err := ctx.findPath(target, paymentAmt)
@@ -2656,7 +2656,7 @@ func TestEqualCostRouteSelection(t *testing.T) {
}
ctx.pathFindingConfig = PathFindingConfig{
PaymentAttemptPenalty: lnwire.NewMSatFromSatoshis(1),
AttemptCost: lnwire.NewMSatFromSatoshis(1),
}
path, err := ctx.findPath(target, paymentAmt)
+2 -2
View File
@@ -79,8 +79,8 @@ func createTestCtxFromGraphInstance(startingHeight uint32, graphInstance *testGr
chainView := newMockChainView(chain)
pathFindingConfig := PathFindingConfig{
MinProbability: 0.01,
PaymentAttemptPenalty: 100,
MinProbability: 0.01,
AttemptCost: 100,
}
mcConfig := &MissionControlConfig{