routing+routerrpc: expose mission control parameters in lnd config

This commit exposes the three main parameters that influence mission
control and path finding to the user as command line or config file
flags. It allows for fine-tuning for optimal results.
This commit is contained in:
Joost Jager committed 2019-06-04 13:22:50 +02:00
1 parent 9b71d90a6e
commit 054e42f680
10 files changed
+145 -32

No files matched your search

+10 -6
View File
@@ -12,9 +12,13 @@ import (
func TestMissionControl(t *testing.T) {
now := testTime
mc := NewMissionControl(nil, nil, nil)
mc := NewMissionControl(
nil, nil, nil, &MissionControlConfig{
PenaltyHalfLife: 30 * time.Minute,
AprioriHopProbability: 0.8,
},
)
mc.now = func() time.Time { return now }
mc.penaltyHalfLife = 30 * time.Minute
testTime := time.Date(2018, time.January, 9, 14, 00, 00, 0, time.UTC)
@@ -36,7 +40,7 @@ func TestMissionControl(t *testing.T) {
}
// Initial probability is expected to be 1.
expectP(1000, 1)
expectP(1000, 0.8)
// Expect probability to be zero after reporting the edge as failed.
mc.reportEdgeFailure(testEdge, 1000)
@@ -44,11 +48,11 @@ func TestMissionControl(t *testing.T) {
// As we reported with a min penalization amt, a lower amt than reported
// should be unaffected.
expectP(500, 1)
expectP(500, 0.8)
// Edge decay started.
now = testTime.Add(30 * time.Minute)
expectP(1000, 0.5)
expectP(1000, 0.4)
// Edge fails again, this time without a min penalization amt. The edge
// should be penalized regardless of amount.
@@ -58,7 +62,7 @@ func TestMissionControl(t *testing.T) {
// Edge decay started.
now = testTime.Add(60 * time.Minute)
expectP(1000, 0.5)
expectP(1000, 0.4)
// A node level failure should bring probability of every channel back
// to zero.