mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 06:32:18 +02:00
graph/db: handle topology updates in a single location
In this commit, we ensure that any topology update is forced to go via the `handleTopologySubscriptions` handler so that client subscriptions and updates are handled correctly and in the correct order. This removes a bug that could result from a client missing a notification about a channel being closed if the client is subscribed and shortly after, `PruneGraph` is called which would notify all subscribed clients and possibly do so before the client subscription has actually been persisted.
This commit is contained in:
@@ -492,9 +492,12 @@ func (c *ChannelGraph) PruneGraph(spentOutputs []*wire.OutPoint,
|
||||
closeSummaries := createCloseSummaries(
|
||||
blockHeight, edges...,
|
||||
)
|
||||
c.notifyTopologyChange(&TopologyChange{
|
||||
ClosedChannels: closeSummaries,
|
||||
})
|
||||
|
||||
select {
|
||||
case c.topologyUpdate <- closeSummaries:
|
||||
case <-c.quit:
|
||||
return nil, ErrChanGraphShuttingDown
|
||||
}
|
||||
}
|
||||
|
||||
return edges, nil
|
||||
|
Reference in New Issue
Block a user