mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-01 18:50:09 +02:00
Merge pull request #6647 from guggero/empty-graph
bugfix: avoid panic with empty graph
This commit is contained in:
commit
daaeab1479
@ -132,6 +132,11 @@ func (graph *SimpleGraph) shortestPathLengths(node int) map[int]uint32 {
|
||||
// thisLevel contains the nodes that are explored in the round.
|
||||
thisLevel := make([]int, 0, graphOrder)
|
||||
|
||||
// Abort if we have an empty graph.
|
||||
if len(graph.Adj) == 0 {
|
||||
return seen
|
||||
}
|
||||
|
||||
// We discover other nodes in a ring-like structure as long as we don't
|
||||
// have more nodes to explore.
|
||||
for len(nextLevel) > 0 {
|
||||
|
@ -185,6 +185,9 @@ from occurring that would result in an erroneous force close.](https://github.co
|
||||
|
||||
* [Fixes a bug that would cause `SignPsbt` to panic w/ an underspecified packet](https://github.com/lightningnetwork/lnd/pull/6611)
|
||||
|
||||
* [Fixes a panic in the graph diameter calculation if the graph is
|
||||
empty](https://github.com/lightningnetwork/lnd/pull/6647).
|
||||
|
||||
## Routing
|
||||
|
||||
* [Add a new `time_pref` parameter to the QueryRoutes and SendPayment APIs](https://github.com/lightningnetwork/lnd/pull/6024) that
|
||||
|
Loading…
x
Reference in New Issue
Block a user