diff --git a/spv/sync.go b/spv/sync.go index d5560a7f4..1cf9a57c3 100644 --- a/spv/sync.go +++ b/spv/sync.go @@ -327,7 +327,7 @@ func (s *Syncer) Run(ctx context.Context) (err error) { s.done = make(chan struct{}) s.err = nil s.doneMu.Unlock() - go func() { + defer func() { s.doneMu.Lock() close(s.done) s.err = err diff --git a/wallet/network.go b/wallet/network.go index fb920a248..6b94ea5b0 100644 --- a/wallet/network.go +++ b/wallet/network.go @@ -170,10 +170,14 @@ func (o OfflineNetworkBackend) Synced(ctx context.Context) (bool, int32) { return true, 0 } +var closedDone = make(chan struct{}) + +func init() { + close(closedDone) +} + func (o OfflineNetworkBackend) Done() <-chan struct{} { - c := make(chan struct{}) - close(c) - return c + return closedDone } func (o OfflineNetworkBackend) Err() error {