MarshalHash marshals for hash
()
| 127 | |
| 128 | // MarshalHash marshals for hash |
| 129 | func (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 |
| 160 | func (z *Header) Msgsize() (s int) { |