routing: use capacity in pathfinding

Extends the pathfinder with a capacity argument for later usage.

In tests, the inserted testCapacity has no effect, but will be used
later to estimate reduced probabilities from it.
This commit is contained in:
bitromortac
2022-05-26 10:18:12 +02:00
parent 2b6308a61f
commit 516e3a8cca
11 changed files with 70 additions and 37 deletions

View File

@@ -105,7 +105,9 @@ var (
// noProbabilitySource is used in testing to return the same probability 1 for
// all edges.
func noProbabilitySource(route.Vertex, route.Vertex, lnwire.MilliSatoshi) float64 {
func noProbabilitySource(route.Vertex, route.Vertex, lnwire.MilliSatoshi,
btcutil.Amount) float64 {
return 1
}
@@ -2796,8 +2798,9 @@ func testProbabilityRouting(t *testing.T, useCache bool,
target := ctx.testGraphInstance.aliasMap["target"]
// Configure a probability source with the test parameters.
ctx.restrictParams.ProbabilitySource = func(fromNode, toNode route.Vertex,
amt lnwire.MilliSatoshi) float64 {
ctx.restrictParams.ProbabilitySource = func(fromNode,
toNode route.Vertex, amt lnwire.MilliSatoshi,
capacity btcutil.Amount) float64 {
if amt == 0 {
t.Fatal("expected non-zero amount")
@@ -2878,8 +2881,9 @@ func runEqualCostRouteSelection(t *testing.T, useCache bool) {
paymentAmt := lnwire.NewMSatFromSatoshis(100)
target := ctx.testGraphInstance.aliasMap["target"]
ctx.restrictParams.ProbabilitySource = func(fromNode, toNode route.Vertex,
amt lnwire.MilliSatoshi) float64 {
ctx.restrictParams.ProbabilitySource = func(fromNode,
toNode route.Vertex, amt lnwire.MilliSatoshi,
capacity btcutil.Amount) float64 {
switch {
case fromNode == alias["source"] && toNode == alias["a"]: