multi: use single read transaction for path finding
This commit partially reverts bf27d05a.
To avoid creating multiple database transactions during a single path
finding operation, we create an explicit transaction when the cached
graph is instantiated.
We cache the source node to avoid needing to look that up for every path
finding session.
The database transaction will be nil in case of the in-memory graph.
This commit is contained in:
9 files changed
+105
-33
No files matched your search
@@ -860,12 +860,13 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
||||
MinProbability: routingConfig.MinRouteProbability,
|
||||
}
|
||||
|
||||
cachedGraph, err := routing.NewCachedGraph(chanGraph)
|
||||
sourceNode, err := chanGraph.SourceNode()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("error getting source node: %v", err)
|
||||
}
|
||||
paymentSessionSource := &routing.SessionSource{
|
||||
Graph: cachedGraph,
|
||||
Graph: chanGraph,
|
||||
SourceNode: sourceNode,
|
||||
MissionControl: s.missionControl,
|
||||
GetLink: s.htlcSwitch.GetLinkByShortID,
|
||||
PathFindingConfig: pathFindingConfig,
|
||||
|
||||
Reference in new issue
Block a user