code: func (ks *KeyStore) refreshWallets() {
  	// Retrieve the current list of accounts
  	ks.mu.Lock()
  	accs := ks.cache.accounts()
  
  	// Transform the current list of wallets into the new one
  	var (
  		wallets = make([]accounts.Wallet, 0, len(accs))
  		events  []accounts.WalletEvent
  	)
  
  	for _, account := range accs {
  		// Drop wallets while they were in front of the next account
  		for len(ks.wallets) > 0 && ks.wallets[0].URL().Cmp(account.URL) < 0 {
  			events = append(events, accounts.WalletEvent{Wallet: ks.wallets[0], Kind: accounts.WalletDropped})
  			ks.wallets = ks.wallets[1:]
  		}
  		// If there are no more wallets or the account is before the next, wrap new wallet
  		if len(ks.wallets) == 0 || ks.wallets[0].URL().Cmp(account.URL) > 0 {
  			wallet := &keystoreWallet{account: account, keystore: ks}
  
  			events = append(events, accounts.WalletEvent{Wallet: wallet, Kind: accounts.WalletArrived})
  			wallets = append(wallets, wallet)
  			continue
  		}
  		// If the account is the same as the first wallet, keep it
  		if ks.wallets[0].Accounts()[0] == account {
  			wallets = append(wallets, ks.wallets[0])
  			ks.wallets = ks.wallets[1:]
  			continue
  		}
  	}
  	// Drop any leftover wallets and set the new batch
  	for _, wallet := range ks.wallets {
  		events = append(events, accounts.WalletEvent{Wallet: wallet, Kind: accounts.WalletDropped})
  	}
  	ks.wallets = wallets
  	ks.mu.Unlock()
  
  	// Fire all wallet events and return
  	for _, event := range events {
  		ks.updateFeed.Send(event)
  	}
  }
docs: // refreshWallets retrieves the current account list and based on that does any
  // necessary wallet refreshes.