mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-09-14 05:20:11 +00:00
16 lines
441 B
Go
16 lines
441 B
Go
package binaryserialization
|
|
|
|
import "encoding/binary"
|
|
|
|
// SerializeChainBlockIndex serializes chain block index
|
|
func SerializeChainBlockIndex(index uint64) []byte {
|
|
var keyBytes [8]byte
|
|
binary.LittleEndian.PutUint64(keyBytes[:], index)
|
|
return keyBytes[:]
|
|
}
|
|
|
|
// DeserializeChainBlockIndex deserializes chain block index to uint64
|
|
func DeserializeChainBlockIndex(indexBytes []byte) uint64 {
|
|
return binary.LittleEndian.Uint64(indexBytes)
|
|
}
|