routing: process successes in mission control

This commit modifies paymentLifecycle so that it not only feeds
failures into mission control, but successes as well.
This allows for more accurate probability estimates. Previously,
the success probability for a successful pair and a pair with
no history was equal. There was no force that pushed towards
previously successful routes.
This commit is contained in:
Joost Jager
2019-07-29 14:20:06 +02:00
parent 2594abfba1
commit ff0c5a0d5e
12 changed files with 415 additions and 190 deletions

View File

@@ -114,6 +114,16 @@ func (ctx *mcTestContext) reportFailure(amt lnwire.MilliSatoshi,
)
}
// reportSuccess reports a success by using a test route.
func (ctx *mcTestContext) reportSuccess() {
err := ctx.mc.ReportPaymentSuccess(ctx.pid, mcTestRoute)
if err != nil {
ctx.t.Fatal(err)
}
ctx.pid++
}
// TestMissionControl tests mission control probability estimation.
func TestMissionControl(t *testing.T) {
ctx := createMcTestContext(t)
@@ -164,9 +174,12 @@ func TestMissionControl(t *testing.T) {
len(history.Nodes))
}
if len(history.Pairs) != 1 {
t.Fatal("unexpected number of channels")
if len(history.Pairs) != 2 {
t.Fatalf("expected 2 pairs, but got %v", len(history.Pairs))
}
// Test reporting a success.
ctx.reportSuccess()
}
// TestMissionControlChannelUpdate tests that the first channel update is not