MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / MarshalHash

Method MarshalHash

types/block_gen.go:129–157  ·  view source on GitHub ↗

MarshalHash marshals for hash

()

Source from the content-addressed store, hash-verified

127
128// MarshalHash marshals for hash
129func (z *Header) MarshalHash() (o []byte, err error) {
130 var b []byte
131 o = hsp.Require(b, z.Msgsize())
132 // map header, size 6
133 o = append(o, 0x86)
134 if oTemp, err := z.GenesisHash.MarshalHash(); err != nil {
135 return nil, err
136 } else {
137 o = hsp.AppendBytes(o, oTemp)
138 }
139 if oTemp, err := z.MerkleRoot.MarshalHash(); err != nil {
140 return nil, err
141 } else {
142 o = hsp.AppendBytes(o, oTemp)
143 }
144 if oTemp, err := z.ParentHash.MarshalHash(); err != nil {
145 return nil, err
146 } else {
147 o = hsp.AppendBytes(o, oTemp)
148 }
149 if oTemp, err := z.Producer.MarshalHash(); err != nil {
150 return nil, err
151 } else {
152 o = hsp.AppendBytes(o, oTemp)
153 }
154 o = hsp.AppendTime(o, z.Timestamp)
155 o = hsp.AppendInt32(o, z.Version)
156 return
157}
158
159// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
160func (z *Header) Msgsize() (s int) {

Callers 4

TestMarshalHashHeaderFunction · 0.95
BenchmarkAppendMsgHeaderFunction · 0.95

Calls 2

MsgsizeMethod · 0.95
MarshalHashMethod · 0.65

Tested by 4

TestMarshalHashHeaderFunction · 0.76
BenchmarkAppendMsgHeaderFunction · 0.76