code: func (am *Manager) update() {
  	// Close all subscriptions when the manager terminates
  	defer func() {
  		am.lock.Lock()
  		for _, sub := range am.updaters {
  			sub.Unsubscribe()
  		}
  		am.updaters = nil
  		am.lock.Unlock()
  	}()
  
  	// Loop until termination
  	for {
  		select {
  		case event := <-am.updates:
  			// Wallet event arrived, update local cache
  			am.lock.Lock()
  			switch event.Kind {
  			case WalletArrived:
  				am.wallets = merge(am.wallets, event.Wallet)
  			case WalletDropped:
  				am.wallets = drop(am.wallets, event.Wallet)
  			}
  			am.lock.Unlock()
  
  			// Notify any listeners of the event
  			am.feed.Send(event)
  
  		case errc := <-am.quit:
  			// Manager terminating, return
  			errc <- nil
  			return
  		}
  	}
  }
docs: // update is the wallet event loop listening for notifications from the backends
  // and updating the cache of wallets.