func (server *OpencxServer) LinkManyWallets(wallets []*wallit.Wallit, tower bool) (err error) {
	for _, wallet := range wallets {
		if err = server.LinkOneWallet(wallet, tower); err != nil {
			return
		}
	}
	return
}
LinkManyWallets takes in a bunch of wallets and links them. We set the tower for all wallets consistently
coinType as specified in the parameters.
package cxserver
import (
	"fmt"
	"os"
	"github.com/mit-dci/lit/btcutil"
	"github.com/mit-dci/lit/coinparam"
	"github.com/mit-dci/lit/wallit"
	util "github.com/mit-dci/opencx/chainutils"
	"github.com/mit-dci/opencx/logging"
)
func (server *OpencxServer) SetupWallet(errChan chan error, subDirName string, param *coinparam.Params, resync bool, hostString string) {
	var err error
	var coinType int
	defer func() {
		if err != nil {
			err = fmt.Errorf("Error when starting wallet: \n%s", err)
		}
		errChan <- err
	}()
	logging.Infof("Starting %s wallet\n", param.Name)
	key, found := server.PrivKeyMap[param]
	if !found {
		err = fmt.Errorf("Could not find key for wallet. Aborting wallet setup")
		return
	}
	if _, err = os.Stat(server.OpencxRoot + subDirName); os.IsNotExist(err) {
		if err = os.MkdirAll(server.OpencxRoot+subDirName, 0700); err != nil {
			logging.Errorf("Error while creating a directory: \n%s", err)
		}
	}
	var wallet *wallit.Wallit
	if wallet, coinType, err = wallit.NewWallit(key, param.StartHeight, resync, hostString, server.OpencxRoot+subDirName, "", param); err != nil {
		return
	}
	server.walletMtx.Lock()
	server.WalletMap[param] = wallet
	server.walletMtx.Unlock()
	logging.Infof("%s wallet Started, cointype: %d\n", param.Name, coinType)
	server.StartChainhookHandlers(wallet)
	return
}
func (server *OpencxServer) SetupAllWallets(hostParamList util.HostParamList, subDirName string, resync bool) (err error) {
	hpLen := len(hostParamList)
	errChan := make(chan error, hpLen)
	for _, hostParam := range hostParamList {
		go server.SetupWallet(errChan, subDirName, hostParam.Param, resync, hostParam.Host)
	}
	for i := 0; i < hpLen; i++ {
		if err = <-errChan; err != nil {
			return
		}
	}
	return
}
func (server *OpencxServer) LinkAllWallets() (err error) {
	for param, _ := range server.SettlementEngines {
		wallet, found := server.WalletMap[param]
		if !found {
			err = fmt.Errorf("Wallet in Coin List not being tracked by exchange in map, start it please")
		}
		if err = server.LinkOneWallet(wallet, false); err != nil {
			return
		}
	}
	logging.Infof("Successfully linked all wallets!")
	return
}