multi: remove the need for the graphsession package

In this commit, we add a `GraphSession` method to the `ChannelGraph`.
This method provides a caller with access to a `NodeTraverser`. This is
used by pathfinding to create a graph "session" overwhich to perform a
set of queries for a pathfinding attempt. With this refactor, we hide
details such as DB transaction creation and transaction commits from the
caller. So with this, pathfinding does not need to remember to "close
the graph session". With this commit, the `graphsession` package may be
completely removed.
This commit is contained in:
Elle Mouton
2025-02-13 09:44:14 +02:00
parent dfe2314a2a
commit e004447da6
11 changed files with 117 additions and 297 deletions

View File

@@ -135,20 +135,18 @@ func createTestCtxFromGraphInstanceAssumeValid(t *testing.T,
sourceNode, err := graphInstance.graph.SourceNode()
require.NoError(t, err)
sessionSource := &SessionSource{
GraphSessionFactory: newMockGraphSessionFactoryFromChanDB(
graphInstance.graph,
),
SourceNode: sourceNode,
GetLink: graphInstance.getLink,
PathFindingConfig: pathFindingConfig,
MissionControl: mc,
GraphSessionFactory: graphInstance.graph,
SourceNode: sourceNode,
GetLink: graphInstance.getLink,
PathFindingConfig: pathFindingConfig,
MissionControl: mc,
}
graphBuilder := newMockGraphBuilder(graphInstance.graph)
router, err := New(Config{
SelfNode: sourceNode.PubKeyBytes,
RoutingGraph: newMockGraphSessionChanDB(graphInstance.graph),
RoutingGraph: graphInstance.graph,
Chain: chain,
Payer: &mockPaymentAttemptDispatcherOld{},
Control: makeMockControlTower(),