multi: pass reset to GraphSession

This commit is contained in:
Elle Mouton committed 2025-07-15 11:25:09 +02:00
1 parent e17fd58a1d
commit b3f3766fe6
9 files changed
+23 -14

No files matched your search

+2 -1
View File
@@ -29,7 +29,8 @@ type GraphSessionFactory interface {
// GraphSession will provide the call-back with access to a
// graphdb.NodeTraverser instance which can be used to perform queries
// against the channel graph.
GraphSession(cb func(graph graphdb.NodeTraverser) error) error
GraphSession(cb func(graph graphdb.NodeTraverser) error,
reset func()) error
}
// FetchAmountPairCapacity determines the maximal public capacity between two
+2 -2
View File
@@ -232,8 +232,8 @@ func (m *mockGraph) FetchNodeFeatures(nodePub route.Vertex) (
// the channel graph.
//
// NOTE: Part of the GraphSessionFactory interface.
func (m *mockGraph) GraphSession(
cb func(graph graphdb.NodeTraverser) error) error {
func (m *mockGraph) GraphSession(cb func(graph graphdb.NodeTraverser) error,
_ func()) error {
return cb(m)
}
+2
View File
@@ -3303,6 +3303,8 @@ func dbFindPath(graph *graphdb.ChannelGraph,
)
return err
}, func() {
route = nil
})
if err != nil {
return nil, err
+5 -1
View File
@@ -343,7 +343,11 @@ func (p *paymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi,
}
for {
err := p.graphSessFactory.GraphSession(findPath)
err := p.graphSessFactory.GraphSession(
findPath, func() {
path = nil
},
)
// If there is an error, and it is not a path finding error, we
// return it immediately.
if err != nil && !lnutils.ErrorAs[*pathFindingError](err) {
+2 -2
View File
@@ -259,8 +259,8 @@ func (g *sessionGraph) sourceNode() route.Vertex {
return route.Vertex{}
}
func (g *sessionGraph) GraphSession(
cb func(graph graphdb.NodeTraverser) error) error {
func (g *sessionGraph) GraphSession(cb func(graph graphdb.NodeTraverser) error,
_ func()) error {
return cb(g)
}