Skip to content

Commit

Permalink
routing: close graph session if getBandwidthHints fails
Browse files Browse the repository at this point in the history
Ensure that the graph session used during pathfinding is properly closed
if the call to getBandwidthHints fails.
  • Loading branch information
ellemouton committed Jul 15, 2024
1 parent 42a56bd commit d575eab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions routing/payment_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit d575eab

Please sign in to comment.