header_sync

package
v1.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2024 License: LGPL-3.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const (
	//function name
	SYNC_GENESIS_HEADER = "syncGenesisHeader"
	SYNC_BLOCK_HEADER   = "syncBlockHeader"

	//key prefix
	BLOCK_HEADER   = "blockHeader"
	CURRENT_HEIGHT = "currentHeight"
	HEADER_INDEX   = "headerIndex"
	CONSENSUS_PEER = "consensusPeer"
	KEY_HEIGHTS    = "keyHeights"
)

Variables

This section is empty.

Functions

func GetHeaderByHash

func GetHeaderByHash(native *native.NativeService, chainID uint64, hash common.Uint256) (*ccom.Header, error)

func GetHeaderByHeight

func GetHeaderByHeight(native *native.NativeService, chainID uint64, height uint32) (*ccom.Header, error)

func InitHeaderSync

func InitHeaderSync()

Init governance contract address

func ProcessHeader

func ProcessHeader(native *native.NativeService, header *ccom.Header, h []byte) error

func PutBlockHeader

func PutBlockHeader(native *native.NativeService, blockHeader *ccom.Header, header []byte) error

func RegisterHeaderSyncContract

func RegisterHeaderSyncContract(native *native.NativeService)

Register methods of governance contract

func SyncBlockHeader

func SyncBlockHeader(native *native.NativeService) ([]byte, error)

func SyncGenesisHeader

func SyncGenesisHeader(native *native.NativeService) ([]byte, error)

func UpdateConsensusPeer

func UpdateConsensusPeer(native *native.NativeService, header *ccom.Header) error

func VerifyHeader

func VerifyHeader(native *native.NativeService, header *ccom.Header) error

verify header of any height find key height and get consensus peer first, then check the sign

Types

type ConsensusPeers

type ConsensusPeers struct {
	ChainID uint64
	Height  uint32
	PeerMap map[string]*Peer
}

func (*ConsensusPeers) Deserialization

func (this *ConsensusPeers) Deserialization(source *common.ZeroCopySource) error

func (*ConsensusPeers) Serialization

func (this *ConsensusPeers) Serialization(sink *common.ZeroCopySink)

type KeyHeights

type KeyHeights struct {
	HeightList []uint32
}

func GetKeyHeights

func GetKeyHeights(native *native.NativeService, chainID uint64) (*KeyHeights, error)

func (*KeyHeights) Deserialization

func (this *KeyHeights) Deserialization(source *common.ZeroCopySource) error

func (*KeyHeights) Serialization

func (this *KeyHeights) Serialization(sink *common.ZeroCopySink)

type Peer

type Peer struct {
	Index      uint32
	PeerPubkey string
}

func (*Peer) Deserialization

func (this *Peer) Deserialization(source *common.ZeroCopySource) error

func (*Peer) Serialization

func (this *Peer) Serialization(sink *common.ZeroCopySink)

type SyncBlockHeaderParam

type SyncBlockHeaderParam struct {
	Address common.Address
	Headers [][]byte
}

func (*SyncBlockHeaderParam) Deserialization

func (this *SyncBlockHeaderParam) Deserialization(source *common.ZeroCopySource) error

func (*SyncBlockHeaderParam) Serialization

func (this *SyncBlockHeaderParam) Serialization(sink *common.ZeroCopySink)

type SyncGenesisHeaderParam

type SyncGenesisHeaderParam struct {
	GenesisHeader []byte
}

func (*SyncGenesisHeaderParam) Deserialization

func (this *SyncGenesisHeaderParam) Deserialization(source *common.ZeroCopySource) error

func (*SyncGenesisHeaderParam) Serialization

func (this *SyncGenesisHeaderParam) Serialization(sink *common.ZeroCopySink)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL