Skip to content

Commit daaeab1

Browse files
authored
Merge pull request #6647 from guggero/empty-graph
bugfix: avoid panic with empty graph
2 parents 9e6f0ef + 5aacc25 commit daaeab1

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

autopilot/simple_graph.go

+5
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ func (graph *SimpleGraph) shortestPathLengths(node int) map[int]uint32 {
132132
// thisLevel contains the nodes that are explored in the round.
133133
thisLevel := make([]int, 0, graphOrder)
134134

135+
// Abort if we have an empty graph.
136+
if len(graph.Adj) == 0 {
137+
return seen
138+
}
139+
135140
// We discover other nodes in a ring-like structure as long as we don't
136141
// have more nodes to explore.
137142
for len(nextLevel) > 0 {

docs/release-notes/release-notes-0.15.0.md

+3
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ from occurring that would result in an erroneous force close.](https://github.co
185185

186186
* [Fixes a bug that would cause `SignPsbt` to panic w/ an underspecified packet](https://github.com/lightningnetwork/lnd/pull/6611)
187187

188+
* [Fixes a panic in the graph diameter calculation if the graph is
189+
empty](https://github.com/lightningnetwork/lnd/pull/6647).
190+
188191
## Routing
189192

190193
* [Add a new `time_pref` parameter to the QueryRoutes and SendPayment APIs](https://github.com/lightningnetwork/lnd/pull/6024) that

0 commit comments

Comments
 (0)