synchro

package
v3.0.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockHashLeastNeighborNumber = 2
	BlockHashExpiredSeconds      = 60
	BlockHashMaxRequestRange     = 100
)

Constant of blockhash sync

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHash

type BlockHash struct {
	Hash   []byte
	PeerID []p2p.PeerID
}

BlockHash return the block hash with the Peers that have it.

type BlockMessage

type BlockMessage struct {
	Blk     *block.Block
	P2PType p2p.MessageType
	From    string
}

BlockMessage define a block from a neighbor node.

type Sync

type Sync struct {
	// contains filtered or unexported fields
}

Sync is the synchronizer of blockchain. It includes requestHandler, heightSync, blockhashSync, blockSync.

func New

func New(p p2p.Service, bCache blockcache.BlockCache, bChain block.Chain) *Sync

New will return a new synchronizer of blockchain.

func (*Sync) Close

func (s *Sync) Close()

Close will close the synchronizer of blockchain.

func (*Sync) IncomingBlock

func (s *Sync) IncomingBlock() <-chan *BlockMessage

IncomingBlock will return the blocks from other nodes. Including passive request and active broadcast.

func (*Sync) IsCatchingUp

func (s *Sync) IsCatchingUp() bool

IsCatchingUp will return whether it is catching up with other nodes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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