Notices where this attachment appears
-
Embed this notice
@lunarised @7666 @Maholmire @dcc @emma @getimiskon @pwm @sjw
> Can you give me a single line of revolver source code so I can tell people to fuck off?
func SerializeBlockMeta(b *FullBlock) []byte {
bf := make([]byte, 2+1+1+8, 2+1+1+8+32)
binary.BigEndian.PutUint16(bf[0:2], 0)
bf[2] = byte(b.Type)
bf[3] = byte(b.Compression)
binary.BigEndian.PutUint64(bf[4:12], b.Sz)
bf = append(bf, b.Hash...)
return bf
}
func DeserializeBlockMeta(b []byte) (*BlockMeta, string) {
m := &BlockMeta{}
// VFlags always zero
m.Type = BlockType(b[2])
m.Compression = CompressionType(b[3])
m.Sz = binary.BigEndian.Uint64(b[4:12])
return m, hex.EncodeToString(b[12:12+32])
}