Documentation
¶
Index ¶
- Constants
- func ConnectParts(version FormatVersion, f []byte, s []byte) ([]byte, error)
- func EncodeCheckpointData(tag BabylonTag, version FormatVersion, rawBTCCheckpoint *RawBtcCheckpoint) ([]byte, []byte, error)
- func GetCheckpointData(tag BabylonTag, version FormatVersion, partIndex uint8, data []byte) ([]byte, error)
- func MustEncodeCheckpointData(tag BabylonTag, version FormatVersion, rawBTCCheckpoint *RawBtcCheckpoint) ([]byte, []byte)
- func U64ToBEBytes(u uint64) []byte
- type BabylonData
- type BabylonTag
- type FormatVersion
- type RawBtcCheckpoint
Constants ¶
View Source
const ( TagLength = 4 CurrentVersion FormatVersion = 0 LastCommitHashLength = 32 BitMapLength = 13 AddressLength = 20 // Each checkpoint is composed of two parts NumberOfParts = 2 BlsSigLength = 48 // 8 bytes are for 64bit unsigned epoch number EpochLength = 8 RawBTCCheckpointLength = EpochLength + LastCommitHashLength + BitMapLength + BlsSigLength + AddressLength )
Variables ¶
This section is empty.
Functions ¶
func ConnectParts ¶
func ConnectParts(version FormatVersion, f []byte, s []byte) ([]byte, error)
ConnectParts composes raw checkpoint data by connecting two parts of checkpoint data and stripping off data that is not relevant to a raw checkpoint
func EncodeCheckpointData ¶
func EncodeCheckpointData( tag BabylonTag, version FormatVersion, rawBTCCheckpoint *RawBtcCheckpoint, ) ([]byte, []byte, error)
func GetCheckpointData ¶
func GetCheckpointData( tag BabylonTag, version FormatVersion, partIndex uint8, data []byte, ) ([]byte, error)
func MustEncodeCheckpointData ¶
func MustEncodeCheckpointData( tag BabylonTag, version FormatVersion, rawBTCCheckpoint *RawBtcCheckpoint, ) ([]byte, []byte)
func U64ToBEBytes ¶
Types ¶
type BabylonData ¶
func IsBabylonCheckpointData ¶
func IsBabylonCheckpointData( tag BabylonTag, version FormatVersion, data []byte, ) (*BabylonData, error)
IsBabylonCheckpointData Checks if given bytearray is potential babylon data, if it is then returns index of data along side with data itself
type BabylonTag ¶
type BabylonTag []byte
type FormatVersion ¶
type FormatVersion uint8
type RawBtcCheckpoint ¶
type RawBtcCheckpoint struct { Epoch uint64 LastCommitHash []byte BitMap []byte SubmitterAddress []byte BlsSig []byte }
func DecodeRawCheckpoint ¶
func DecodeRawCheckpoint(version FormatVersion, btcCkptBytes []byte) (*RawBtcCheckpoint, error)
DecodeRawCheckpoint extracts epoch, lastCommitHash, bitmap, and blsSig from a flat byte array and compose them into a RawCheckpoint struct
Click to show internal directories.
Click to hide internal directories.