Skip to content

Commit 5d29910

Browse files
committed
[release-v2.0] Prevent hang when dcrd connection is lost
The ordered shutdown of wallet goroutines before closing the websocket connection introduced a new bug where the RPC syncer would hang if the dcrd connection is lost before clean shutdown is signaled, due to a missing call to cancel the context passed to Wallet.Run. Backport of d3e2a05.
1 parent 8e4b1da commit 5d29910

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

chain/sync.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -759,13 +759,15 @@ func (s *Syncer) Run(ctx context.Context) (err error) {
759759
log.Infof("Blockchain sync completed, wallet ready for general usage.")
760760

761761
g.Go(func() error {
762+
var err error
762763
select {
763764
case <-ctx.Done():
764-
walletCtxCancel()
765-
return ctx.Err()
765+
err = ctx.Err()
766766
case <-wsClient.Done():
767-
return wsClient.Err()
767+
err = wsClient.Err()
768768
}
769+
walletCtxCancel()
770+
return err
769771
})
770772
return g.Wait()
771773
}

0 commit comments

Comments
 (0)