multi: pass reset to GraphSession
This commit is contained in:
9 files changed
+23
-14
No files matched your search
+2
-1
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -3303,6 +3303,8 @@ func dbFindPath(graph *graphdb.ChannelGraph,
|
||||
)
|
||||
|
||||
return err
|
||||
}, func() {
|
||||
route = nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user