diff --git a/lnd_test.go b/lnd_test.go index 4b5962f9..d20c18d8 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -2860,7 +2860,8 @@ out: if err := carol.Shutdown(); err != nil { t.Fatalf("unable to shutdown carol: %v", err) } - time.Sleep(time.Second * 2) + // TODO(roasbeef): mission control + time.Sleep(time.Second * 5) alicePayStream, err = net.Alice.SendPayment(ctxb) if err != nil { t.Fatalf("unable to create payment stream: %v", err) diff --git a/routing/router_test.go b/routing/router_test.go index e6fc6d82..9e768d13 100644 --- a/routing/router_test.go +++ b/routing/router_test.go @@ -175,6 +175,8 @@ func TestSendPaymentRouteFailureFallback(t *testing.T) { var preImage [32]byte copy(preImage[:], bytes.Repeat([]byte{9}, 32)) + sourceNode := ctx.router.selfNode + // We'll modify the SendToSwitch method that's been set within the // router's configuration to ignore the path that has luo ji as the // first hop. This should force the router to instead take the @@ -184,7 +186,9 @@ func TestSendPaymentRouteFailureFallback(t *testing.T) { if ctx.aliases["luoji"].IsEqual(n) { return [32]byte{}, &htlcswitch.ForwardingError{ - FailureMessage: &lnwire.FailTemporaryNodeFailure{}, + ErrorSource: sourceNode.PubKey, + // TODO(roasbeef): temp node failure should be? + FailureMessage: &lnwire.FailTemporaryChannelFailure{}, } } @@ -277,6 +281,8 @@ func TestSendPaymentErrorPathPruning(t *testing.T) { return preImage, nil } + ctx.router.missionControl.ResetHistory() + // When we try to dispatch that payment, we should receive an error as // both attempts should fail and cause both routes to be pruned. _, _, err = ctx.router.SendPayment(&payment) @@ -290,6 +296,8 @@ func TestSendPaymentErrorPathPruning(t *testing.T) { t.Fatalf("expected UnknownNextPeer instead got: %v", err) } + ctx.router.missionControl.ResetHistory() + // Next, we'll modify the SendToSwitch method to indicate that luo ji // wasn't originally online. This should also halt the send all // together as all paths contain luoji and he can't be reached. @@ -316,6 +324,8 @@ func TestSendPaymentErrorPathPruning(t *testing.T) { t.Fatalf("expected UnknownNextPeer instead got: %v", err) } + ctx.router.missionControl.ResetHistory() + // Finally, we'll modify the SendToSwitch function to indicate that the // roasbeef -> luoji channel has insufficient capacity. ctx.router.cfg.SendToSwitch = func(n *btcec.PublicKey, @@ -337,9 +347,8 @@ func TestSendPaymentErrorPathPruning(t *testing.T) { t.Fatalf("unable to send payment: %v", err) } - // This should succeed finally. - // The route selected should have two hops - // + // This should succeed finally. The route selected should have two + // hops. if len(route.Hops) != 2 { t.Fatalf("incorrect route length: expected %v got %v", 2, len(route.Hops))