github.com/annchain/OG@v0.0.9/consensus/vrf/vrf_gen.go (about) 1 package vrf 2 3 // Code generated by github.com/tinylib/msgp DO NOT EDIT. 4 5 import ( 6 "github.com/tinylib/msgp/msgp" 7 ) 8 9 // DecodeMsg implements msgp.Decodable 10 func (z *VrfData) DecodeMsg(dc *msgp.Reader) (err error) { 11 var zb0001 uint32 12 zb0001, err = dc.ReadArrayHeader() 13 if err != nil { 14 return 15 } 16 if zb0001 != 3 { 17 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 18 return 19 } 20 err = z.SeqHash.DecodeMsg(dc) 21 if err != nil { 22 return 23 } 24 z.Height, err = dc.ReadUint64() 25 if err != nil { 26 return 27 } 28 z.TxNum, err = dc.ReadInt() 29 if err != nil { 30 return 31 } 32 return 33 } 34 35 // EncodeMsg implements msgp.Encodable 36 func (z *VrfData) EncodeMsg(en *msgp.Writer) (err error) { 37 // array header, size 3 38 err = en.Append(0x93) 39 if err != nil { 40 return 41 } 42 err = z.SeqHash.EncodeMsg(en) 43 if err != nil { 44 return 45 } 46 err = en.WriteUint64(z.Height) 47 if err != nil { 48 return 49 } 50 err = en.WriteInt(z.TxNum) 51 if err != nil { 52 return 53 } 54 return 55 } 56 57 // MarshalMsg implements msgp.Marshaler 58 func (z *VrfData) MarshalMsg(b []byte) (o []byte, err error) { 59 o = msgp.Require(b, z.Msgsize()) 60 // array header, size 3 61 o = append(o, 0x93) 62 o, err = z.SeqHash.MarshalMsg(o) 63 if err != nil { 64 return 65 } 66 o = msgp.AppendUint64(o, z.Height) 67 o = msgp.AppendInt(o, z.TxNum) 68 return 69 } 70 71 // UnmarshalMsg implements msgp.Unmarshaler 72 func (z *VrfData) UnmarshalMsg(bts []byte) (o []byte, err error) { 73 var zb0001 uint32 74 zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) 75 if err != nil { 76 return 77 } 78 if zb0001 != 3 { 79 err = msgp.ArrayError{Wanted: 3, Got: zb0001} 80 return 81 } 82 bts, err = z.SeqHash.UnmarshalMsg(bts) 83 if err != nil { 84 return 85 } 86 z.Height, bts, err = msgp.ReadUint64Bytes(bts) 87 if err != nil { 88 return 89 } 90 z.TxNum, bts, err = msgp.ReadIntBytes(bts) 91 if err != nil { 92 return 93 } 94 o = bts 95 return 96 } 97 98 // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message 99 func (z *VrfData) Msgsize() (s int) { 100 s = 1 + z.SeqHash.Msgsize() + msgp.Uint64Size + msgp.IntSize 101 return 102 }