routing: add source parameter to query routes

This commit allows execution of QueryRoutes from any source node.
Previously this was restricted to only the self node.
This commit is contained in:
Joost Jager
2019-03-05 16:49:26 +01:00
parent 7719bc432f
commit c62c9d64da
7 changed files with 646 additions and 586 deletions

View File

@ -184,6 +184,7 @@ func TestFindRoutesFeeSorting(t *testing.T) {
paymentAmt := lnwire.NewMSatFromSatoshis(100)
target := ctx.aliases["luoji"]
routes, err := ctx.router.FindRoutes(
ctx.router.selfNode.PubKeyBytes,
target, paymentAmt, noRestrictions, defaultNumRoutes,
DefaultFinalCLTVDelta,
)
@ -245,6 +246,7 @@ func TestFindRoutesWithFeeLimit(t *testing.T) {
}
routes, err := ctx.router.FindRoutes(
ctx.router.selfNode.PubKeyBytes,
target, paymentAmt, restrictions, defaultNumRoutes,
DefaultFinalCLTVDelta,
)
@ -1341,6 +1343,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
var targetPubKeyBytes Vertex
copy(targetPubKeyBytes[:], targetNode.SerializeCompressed())
routes, err := ctx.router.FindRoutes(
ctx.router.selfNode.PubKeyBytes,
targetPubKeyBytes, paymentAmt, noRestrictions, defaultNumRoutes,
DefaultFinalCLTVDelta,
)
@ -1386,6 +1389,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
// Should still be able to find the routes, and the info should be
// updated.
routes, err = ctx.router.FindRoutes(
ctx.router.selfNode.PubKeyBytes,
targetPubKeyBytes, paymentAmt, noRestrictions, defaultNumRoutes,
DefaultFinalCLTVDelta,
)