routing: close graph session if getBandwidthHints fails

Ensure that the graph session used during pathfinding is properly closed
if the call to getBandwidthHints fails.
This commit is contained in:
Elle Mouton 2024-07-15 15:01:28 +02:00
parent 90dff730ce
commit d1c54d74a8
No known key found for this signature in database
GPG Key ID: D7D916376026F177

View File

@ -294,6 +294,12 @@ func (p *paymentSession) RequestRoute(maxAmt, feeLimit lnwire.MilliSatoshi,
// attempt, because concurrent payments may change balances.
bandwidthHints, err := p.getBandwidthHints(graph)
if err != nil {
// Close routing graph session.
if graphErr := closeGraph(); graphErr != nil {
log.Errorf("could not close graph session: %v",
graphErr)
}
return nil, err
}