package zcash

import (
	//"fmt"
)

var (
	zcashErrMsg map[int]string
)

const (
	OK       = 0
	TIME_OUT = iota + 20
	WALLETINFO_ERR
	INNER_ERR
	TRANSINFO_ERR
	AMOUNT_ERR
	SENDCOINS_ERR
	GETBALANCE_ERR
	GETUNCONFIRMEDBALANCE_ERR
	GETNEWADDRESS_ERR
	DUMPPRIVKEY_ERR
	GETCLOCKCOUNT_ERR
	GETBLOCKINFO_ERR
	UNKNOWN_ERR
)

func initZcashErr() {
	//var limitInfo = fmt.Sprintf("小于等于%v", ZecConfig.Limit.Fee)
	zcashErrMsg = make(map[int]string)
	zcashErrMsg[0] = "成功"
	zcashErrMsg[22] = "zcash 钱包信息查询错误"
	zcashErrMsg[23] = "zcash 内部错误"
	zcashErrMsg[24] = "zcash 获取交易信息出错"
	zcashErrMsg[25] = "zcash 传入的转账金额不合法"
	zcashErrMsg[26] = "zcash 发送数字币出错"
	zcashErrMsg[27] = "zcash 获取已确认余额出错"
	zcashErrMsg[28] = "zcash 获取未确认的余额出错"
	zcashErrMsg[29] = "zcash 获取地址出错"
	zcashErrMsg[30] = "zcash 获取私钥出错"
	zcashErrMsg[31] = "zcash 获取当前区块链的高度出错"
	zcashErrMsg[32] = "zcash 获取区块链信息出错"
}

func getErrMsg(ret int, data []byte) string {
	msg, ok := zcashErrMsg[ret]
	if ok {
		return msg
	}
	return string(data)
}
