From 55f751fd37959e169931752c6a3597d8d38d1598 Mon Sep 17 00:00:00 2001 From: t4sk Date: Wed, 28 Feb 2018 10:09:41 +0700 Subject: [PATCH] routing/router Fix FindRoutes in router test In router_test FindRoutes is passing DefaultFinalCLTVDelta in place where numPaths is expected. This commit passes a default numPaths for function calls to FindRoutes so that final cltv delta are correctly passed. --- routing/router_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/routing/router_test.go b/routing/router_test.go index 552684ce..f4be1f88 100644 --- a/routing/router_test.go +++ b/routing/router_test.go @@ -19,6 +19,10 @@ import ( "github.com/roasbeef/btcd/btcec" ) +// defaultNumRoutes is the default value for the maximum number of routes to +// be returned by FindRoutes +const defaultNumRoutes = 10 + type testCtx struct { router *ChannelRouter @@ -169,7 +173,7 @@ func TestFindRoutesFeeSorting(t *testing.T) { paymentAmt := lnwire.NewMSatFromSatoshis(100) target := ctx.aliases["luoji"] routes, err := ctx.router.FindRoutes(target, paymentAmt, - DefaultFinalCLTVDelta) + defaultNumRoutes, DefaultFinalCLTVDelta) if err != nil { t.Fatalf("unable to find any routes: %v", err) } @@ -719,7 +723,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) { paymentAmt := lnwire.NewMSatFromSatoshis(100) targetNode := priv2.PubKey() routes, err := ctx.router.FindRoutes(targetNode, paymentAmt, - DefaultFinalCLTVDelta) + defaultNumRoutes, DefaultFinalCLTVDelta) if err != nil { t.Fatalf("unable to find any routes: %v", err) } @@ -762,7 +766,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) { // Should still be able to find the route, and the info should be // updated. routes, err = ctx.router.FindRoutes(targetNode, paymentAmt, - DefaultFinalCLTVDelta) + defaultNumRoutes, DefaultFinalCLTVDelta) if err != nil { t.Fatalf("unable to find any routes: %v", err) }