Versions in this module Expand all Collapse all v1 v1.10.2 Dec 15, 2024 Changes in this version + const LastMileBlocksSize + const LoopMinTime + const NumPeersLowBound + const RegistrationNumber + const SyncLoopBatchSize + const SyncingPortDifference + var ErrDownloadBlocks = errors.New("[SYNC]: get download blocks failed") + var ErrGenStateSyncTaskQueue = errors.New("[SYNC]: generate state sync task queue failed") + var ErrGenerateNewState = errors.New("[SYNC]: get generate new state failed") + var ErrGetBlock = errors.New("[SYNC]: get block failed") + var ErrGetBlockHash = errors.New("[SYNC]: get blockhash failed") + var ErrGetConsensusHashes = errors.New("[SYNC]: get consensus hashes failed") + var ErrProcessStateSync = errors.New("[SYNC]: get blockhash failed") + var ErrRegistrationFail = errors.New("[SYNC]: registration failed") + var ErrUpdateBlockAndStatus = errors.New("[SYNC]: update block and status failed") + func CompareBlockByHash(a *types.Block, b *types.Block) int + func CompareSyncPeerConfigByblockHashes(a *SyncPeerConfig, b *SyncPeerConfig) int + func GetHowManyMaxConsensus(blocks []*types.Block) (int, int) + func GetSyncingPort(nodePort string) string + func ParseResult(res SyncCheckResult) (IsSynchronized bool, OtherHeight uint64, HeightDiff uint64) + func ProcessStateSync(syncConfig *SyncConfig, heights []uint64, bc core.BlockChain) error + func RlpDecodeBlockOrBlockWithSig(payload []byte) (*types.Block, error) + type BlockWithSig struct + Block *types.Block + CommitSigAndBitmap []byte + type EpochSync struct + func (ss *EpochSync) CreateSyncConfig(peers []p2p.Peer, shardID uint32, selfPeerID libp2p_peer.ID, ...) error + func (ss *EpochSync) GetActivePeerNumber() int + func (ss *EpochSync) GetSyncStatus() SyncCheckResult + func (ss *EpochSync) SyncLoop(bc core.BlockChain, consensus *consensus.Consensus) time.Duration + type StateSync struct + func CreateStateSync(bc blockChain, ip string, port string, peerHash [20]byte, ...) *StateSync + func (ss *StateSync) AddLastMileBlock(block *types.Block) + func (ss *StateSync) AddNewBlock(peerHash []byte, block *types.Block) + func (ss *StateSync) CreateSyncConfig(peers []p2p.Peer, shardID uint32, selfPeerID libp2p_peer.ID, ...) error + func (ss *StateSync) GetActivePeerNumber() int + func (ss *StateSync) GetMaxPeerHeight() (uint64, error) + func (ss *StateSync) GetParsedSyncStatus() (IsSynchronized bool, OtherHeight uint64, HeightDiff uint64) + func (ss *StateSync) GetParsedSyncStatusDoubleChecked() (IsSynchronized bool, OtherHeight uint64, HeightDiff uint64) + func (ss *StateSync) GetSyncStatus() SyncCheckResult + func (ss *StateSync) GetSyncStatusDoubleChecked() SyncCheckResult + func (ss *StateSync) IntoEpochSync() *EpochSync + func (ss *StateSync) IsSameBlockchainHeight(bc core.BlockChain) (uint64, bool) + func (ss *StateSync) IsSynchronized() bool + func (ss *StateSync) ProcessStateSync(startHash []byte, size uint32, bc core.BlockChain) error + func (ss *StateSync) RegisterNodeInfo() int + func (ss *StateSync) SyncLoop(bc core.BlockChain, isBeacon bool, consensus *consensus.Consensus, ...) + func (ss *StateSync) UpdateBlockAndStatus(block *types.Block, bc core.BlockChain) error + type SyncBlockTask struct + type SyncCheckResult struct + HeightDiff uint64 + IsSynchronized bool + OtherHeight uint64 + type SyncConfig struct + func NewSyncConfig(shardID uint32, selfPeerID libp2p_peer.ID, peers []*SyncPeerConfig) *SyncConfig + func (sc *SyncConfig) AddPeer(peer *SyncPeerConfig) + func (sc *SyncConfig) CloseConnections() + func (sc *SyncConfig) FindPeerByHash(peerHash []byte) *SyncPeerConfig + func (sc *SyncConfig) ForEachPeer(f func(peer *SyncPeerConfig) (brk bool)) + func (sc *SyncConfig) GetBlockHashesConsensusAndCleanUp() error + func (sc *SyncConfig) GetPeers() []*SyncPeerConfig + func (sc *SyncConfig) InitForTesting(client *downloader.Client, blockHashes [][]byte) + func (sc *SyncConfig) PeersCount() int + func (sc *SyncConfig) RemovePeer(peer *SyncPeerConfig, reason string) + func (sc *SyncConfig) ShardID() uint32 + type SyncPeerConfig struct + func CreateTestSyncPeerConfig(client *downloader.Client, blockHashes [][]byte) *SyncPeerConfig + func (peerConfig *SyncPeerConfig) GetBlocks(hashes [][]byte) ([][]byte, error) + func (peerConfig *SyncPeerConfig) GetClient() *downloader.Client + func (peerConfig *SyncPeerConfig) IsEqual(pc2 *SyncPeerConfig) bool + func (peerConfig *SyncPeerConfig) String() interface{}