mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
pilot: avoid cancelling the tx subscription twice, use proper wg value
In this commit we fix a newly introduce bug wherein we would close the transaction subscription twice on shutdown. This would lead to a shutdown, but an unclean one as it would panic due to closing a channel twice. We fix this my removing a defer statement such that, we’ll only cancel the subscription once.
This commit is contained in:
parent
9a76b3ee58
commit
e5b74174b5
3
pilot.go
3
pilot.go
@ -183,7 +183,7 @@ func initAutoPilot(svr *server, cfg *autoPilotConfig) (*autopilot.Agent, error)
|
||||
|
||||
// We'll launch a goroutine to provide the agent with notifications
|
||||
// whenever the balance of the wallet changes.
|
||||
svr.wg.Add(1)
|
||||
svr.wg.Add(2)
|
||||
go func() {
|
||||
defer txnSubscription.Cancel()
|
||||
defer svr.wg.Done()
|
||||
@ -199,7 +199,6 @@ func initAutoPilot(svr *server, cfg *autoPilotConfig) (*autopilot.Agent, error)
|
||||
|
||||
}()
|
||||
go func() {
|
||||
defer txnSubscription.Cancel()
|
||||
defer svr.wg.Done()
|
||||
|
||||
for {
|
||||
|
Loading…
Reference in New Issue
Block a user