routing: define graphParams and restrictParams

To avoid the findPath parameter list getting out of hand, we define new
structs that wraps the mandatory and optional parameters to findPath.
This commit is contained in:
Johan T. Halseth committed 2018-12-04 12:20:44 +01:00
1 parent 640fe2558b
commit 20b9d5d000
4 files changed
+183 -46

No files matched your search

+11 -3
View File
@@ -406,9 +406,17 @@ func (p *paymentSession) RequestRoute(payment *LightningPayment,
// to our destination, respecting the recommendations from
// missionControl.
path, err := findPath(
nil, p.mc.graph, p.additionalEdges, p.mc.selfNode,
payment.Target, pruneView.vertexes, pruneView.edges,
payment.Amount, payment.FeeLimit, p.bandwidthHints,
&graphParams{
graph: p.mc.graph,
additionalEdges: p.additionalEdges,
bandwidthHints: p.bandwidthHints,
},
&restrictParams{
ignoredNodes: pruneView.vertexes,
ignoredEdges: pruneView.edges,
feeLimit: payment.FeeLimit,
},
p.mc.selfNode, payment.Target, payment.Amount,
)
if err != nil {
return nil, err