mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-24 04:34:39 +02:00
server: convert Start/Stop methods to use sync.Once
In this commit, we convert the server's Start/Stop methods to use the sync.Once. We do this in order to fix concurrency issues that would allow certain queries to be sent to the server before it has actually fully start up. Before this commit, we would set started to 1 at the very top of the method, allowing certain queries to pass before the rest of the daemon was had started up. In order to fix this issue, we've converted the server to using a sync.Once, and two new atomic variables for clients to query to see if the server has fully started up, or is in the process of stopping.
This commit is contained in:
@@ -121,7 +121,8 @@ func (c *chanDBRestorer) RestoreChansFromSingles(backups ...chanbackup.Single) e
|
||||
channelShells = append(channelShells, chanShell)
|
||||
}
|
||||
|
||||
ltndLog.Infof("Inserting %v SCB channel shells into DB")
|
||||
ltndLog.Infof("Inserting %v SCB channel shells into DB",
|
||||
len(channelShells))
|
||||
|
||||
// Now that we have all the backups mapped into a series of Singles,
|
||||
// we'll insert them all into the database.
|
||||
|
Reference in New Issue
Block a user