Documentation ¶
Index ¶
- type Chain
- type Fetcher
- type LocalStore
- type Manager
- type Mempool
- type MsgFetcher
- type ProtocolReactor
- func (pr *ProtocolReactor) AddPeer(peer *p2p.Peer) error
- func (pr *ProtocolReactor) GetChannels() []*connection.ChannelDescriptor
- func (pr *ProtocolReactor) OnStart() error
- func (pr *ProtocolReactor) OnStop()
- func (pr *ProtocolReactor) Receive(chID byte, src *p2p.Peer, msgBytes []byte)
- func (pr *ProtocolReactor) RemovePeer(peer *p2p.Peer, reason interface{})
- type Switch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain interface { BestBlockHeader() *types.BlockHeader LastJustifiedHeader() (*types.BlockHeader, error) BestBlockHeight() uint64 GetBlockByHash(*bc.Hash) (*types.Block, error) GetBlockByHeight(uint64) (*types.Block, error) GetHeaderByHash(*bc.Hash) (*types.BlockHeader, error) GetHeaderByHeight(uint64) (*types.BlockHeader, error) InMainChain(bc.Hash) bool ProcessBlock(*types.Block) (bool, error) ValidateTx(*types.Tx) (bool, error) }
Chain is the interface for Bytom core
type Fetcher ¶
type Fetcher interface {
// contains filtered or unexported methods
}
Fetcher is the interface for fetch struct
type LocalStore ¶
type LocalStore interface {
// contains filtered or unexported methods
}
LocalStore is the interface for persistent storage
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is responsible for the business layer information synchronization
func NewManager ¶
func NewManager(config *cfg.Config, sw Switch, chain Chain, mempool Mempool, dispatcher *event.Dispatcher, peers *peers.PeerSet, fastSyncDB dbm.DB) (*Manager, error)
NewManager create a chain sync manager.
func (*Manager) IsCaughtUp ¶
IsCaughtUp check wheather the peer finish the sync
func (*Manager) RemovePeer ¶
RemovePeer delete peer for peer set
func (*Manager) SendStatus ¶
SendStatus sent the current self status to remote peer
type MsgFetcher ¶
type MsgFetcher interface {
// contains filtered or unexported methods
}
MsgFetcher is the interface for msg fetch struct
type ProtocolReactor ¶
type ProtocolReactor struct { p2p.BaseReactor // contains filtered or unexported fields }
ProtocolReactor handles new coming protocol message.
func NewProtocolReactor ¶
func NewProtocolReactor(manager *Manager) *ProtocolReactor
NewProtocolReactor returns the reactor of whole blockchain.
func (*ProtocolReactor) AddPeer ¶
func (pr *ProtocolReactor) AddPeer(peer *p2p.Peer) error
AddPeer implements Reactor by sending our state to peer.
func (*ProtocolReactor) GetChannels ¶
func (pr *ProtocolReactor) GetChannels() []*connection.ChannelDescriptor
GetChannels implements Reactor
func (*ProtocolReactor) OnStart ¶
func (pr *ProtocolReactor) OnStart() error
OnStart implements BaseService
func (*ProtocolReactor) Receive ¶
func (pr *ProtocolReactor) Receive(chID byte, src *p2p.Peer, msgBytes []byte)
Receive implements Reactor by handling 4 types of messages (look below).
func (*ProtocolReactor) RemovePeer ¶
func (pr *ProtocolReactor) RemovePeer(peer *p2p.Peer, reason interface{})
RemovePeer implements Reactor by removing peer from the pool.