package lite

//"fmt"

var (
	liteErrMsg 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
	SEND_RAW_TRANSACTION_ERR
	PARM_ERR
	UNKNOWN_ERR
)

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

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