package lite

var (
	ltcErrMsg map[int]string
)

const (
	OK       = 0
	TIME_OUT = iota + 40
	TRANSINFO_ERR
	INNER_ERR
	ADDRESS_ERR
	PARM_ERR
	BLOCKID_ERR
	BLOCKHEIGHT_ERR
	UNKNOWN_ERR
	KNOWN_ERR
)

func initLiteErr() {
	ltcErrMsg = make(map[int]string)
	ltcErrMsg[OK] = "成功"
	ltcErrMsg[TRANSINFO_ERR] = "query trans by txid err"
	ltcErrMsg[INNER_ERR] = "inner error"
	ltcErrMsg[ADDRESS_ERR] = "query trans by address err"
	ltcErrMsg[PARM_ERR] = "parments error"
	ltcErrMsg[BLOCKID_ERR] = "query trans by blockid err"
	ltcErrMsg[BLOCKHEIGHT_ERR] = "query block height  err"
	ltcErrMsg[UNKNOWN_ERR] = ""

}

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