示例#1
0
文件: rcd1.go 项目: jjdevbiz/factomd
func (a RCD_1) CustomMarshalText() (text []byte, err error) {
	var out bytes.Buffer
	out.WriteString("RCD 1: ")
	primitives.WriteNumber8(&out, uint8(1)) // Type Zero Authorization
	out.WriteString(" ")
	out.WriteString(hex.EncodeToString(a.PublicKey[:]))
	out.WriteString("\n")

	return out.Bytes(), nil
}
示例#2
0
func (a RCD_2) CustomMarshalText() ([]byte, error) {
	var out primitives.Buffer

	primitives.WriteNumber8(&out, uint8(2)) // Type 2 Authorization
	out.WriteString("\n n: ")
	primitives.WriteNumber16(&out, uint16(a.N))
	out.WriteString(" m: ")
	primitives.WriteNumber16(&out, uint16(a.M))
	out.WriteString("\n")
	for i := 0; i < a.M; i++ {
		out.WriteString("  m: ")
		out.WriteString(hex.EncodeToString(a.N_Addresses[i].Bytes()))
		out.WriteString("\n")
	}

	return out.DeepCopyBytes(), nil
}