routing: use routingGraph interface in payment session

Preparation for more test coverage of payment session.

The function findPath now has the call signature of the former
findPathInternal function.
This commit is contained in:
Joost Jager
2020-03-17 11:32:07 +01:00
parent cb4cd49dc8
commit 47f9c1c3fd
9 changed files with 155 additions and 146 deletions

View File

@ -1426,13 +1426,25 @@ func (r *ChannelRouter) FindRoute(source, target route.Vertex,
// execute our path finding algorithm.
finalHtlcExpiry := currentHeight + int32(finalExpiry)
routingTx, err := newDbRoutingTx(r.cfg.Graph)
if err != nil {
return nil, err
}
defer func() {
err := routingTx.close()
if err != nil {
log.Errorf("Error closing db tx: %v", err)
}
}()
path, err := findPath(
&graphParams{
graph: r.cfg.Graph,
bandwidthHints: bandwidthHints,
additionalEdges: routeHints,
bandwidthHints: bandwidthHints,
graph: routingTx,
},
restrictions, &r.cfg.PathFindingConfig,
restrictions,
&r.cfg.PathFindingConfig,
source, target, amt, finalHtlcExpiry,
)
if err != nil {