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.
This commit is contained in:
t4sk 2018-02-28 10:09:41 +07:00 committed by Olaoluwa Osuntokun
parent f7ec490f44
commit 55f751fd37
1 changed files with 7 additions and 3 deletions

View File

@ -19,6 +19,10 @@ import (
"github.com/roasbeef/btcd/btcec" "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 { type testCtx struct {
router *ChannelRouter router *ChannelRouter
@ -169,7 +173,7 @@ func TestFindRoutesFeeSorting(t *testing.T) {
paymentAmt := lnwire.NewMSatFromSatoshis(100) paymentAmt := lnwire.NewMSatFromSatoshis(100)
target := ctx.aliases["luoji"] target := ctx.aliases["luoji"]
routes, err := ctx.router.FindRoutes(target, paymentAmt, routes, err := ctx.router.FindRoutes(target, paymentAmt,
DefaultFinalCLTVDelta) defaultNumRoutes, DefaultFinalCLTVDelta)
if err != nil { if err != nil {
t.Fatalf("unable to find any routes: %v", err) t.Fatalf("unable to find any routes: %v", err)
} }
@ -719,7 +723,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
paymentAmt := lnwire.NewMSatFromSatoshis(100) paymentAmt := lnwire.NewMSatFromSatoshis(100)
targetNode := priv2.PubKey() targetNode := priv2.PubKey()
routes, err := ctx.router.FindRoutes(targetNode, paymentAmt, routes, err := ctx.router.FindRoutes(targetNode, paymentAmt,
DefaultFinalCLTVDelta) defaultNumRoutes, DefaultFinalCLTVDelta)
if err != nil { if err != nil {
t.Fatalf("unable to find any routes: %v", err) 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 // Should still be able to find the route, and the info should be
// updated. // updated.
routes, err = ctx.router.FindRoutes(targetNode, paymentAmt, routes, err = ctx.router.FindRoutes(targetNode, paymentAmt,
DefaultFinalCLTVDelta) defaultNumRoutes, DefaultFinalCLTVDelta)
if err != nil { if err != nil {
t.Fatalf("unable to find any routes: %v", err) t.Fatalf("unable to find any routes: %v", err)
} }