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
	}

	// create wallit root directory
	if _, err = os.Stat(server.OpencxRoot + subDirName); os.IsNotExist(err) {
		if err = os.Mkdir(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)
	// figure out whether or not to do this if merged

	server.StartChainhookHandlers(wallet)

	return
}
// SetupWallet sets up a wallet for a specific coin, based on params.
SetupWallet sets up a wallet for a specific coin, based on params.
// SetupWallet sets up a wallet for a specific coin based on params .
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.Mkdir(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 ) 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 ( " \n " , err ) } errChan <- err } ( ) logging . Infof ( " \n " , param . Name ) key , found := server . PrivKeyMap [ param ] if ! found { err = fmt . Errorf ( " " ) return } if _ , err = os . Stat ( server . OpencxRoot + subDirName ) ; os . IsNotExist ( err ) { if err = os . Mkdir ( server . OpencxRoot + subDirName , 0700 ) ; err != nil { logging . Errorf ( " \n " , 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 ( " \n " , param . Name , coinType ) server . StartChainhookHandlers ( wallet ) return }
SetupWallet sets up a wallet for a specific coin, based on params.
SetupWallet sets up a wallet for a specific coin based on params .
// create wallit root directory // figure out whether or not to do this if merged