Documentation ¶
Index ¶
Constants ¶
View Source
const ( FullSync int = iota FastSync LightSync )
View Source
const ( HandshakeCode int = 100 SyncTxnsCode = 101 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlocksRange ¶
type BlocksRange struct { StartHeight BlockNum EndHeight BlockNum }
type HandShakeInfo ¶
type HandShakeInfo struct { GenesisBlockHash Hash // when chain is finlaized chain, end block is the finalized block EndHeight BlockNum EndBlockHash Hash }
func (*HandShakeInfo) Compare ¶
func (hs *HandShakeInfo) Compare(other *HandShakeInfo) (*BlocksRange, error)
Compare return a BlocksRange if other node's height is lower
type HandShakeRequest ¶
type HandShakeRequest struct { FetchRange *BlocksRange Info *HandShakeInfo }
func DecodeHsRequest ¶
func DecodeHsRequest(data []byte) (*HandShakeRequest, error)
func (*HandShakeRequest) Encode ¶
func (hs *HandShakeRequest) Encode() ([]byte, error)
type HandShakeResp ¶
type HandShakeResp struct { // missing blocks range MissingRange *BlocksRange // blocks bytes BlocksByt []byte Err error }
func DecodeHsResp ¶
func DecodeHsResp(data []byte) (*HandShakeResp, error)
func (*HandShakeResp) Encode ¶
func (hs *HandShakeResp) Encode() ([]byte, error)
type Synchronizer ¶
type Synchronizer struct { *Tripod // contains filtered or unexported fields }
func NewSynchronizer ¶
func NewSynchronizer(syncMode int) *Synchronizer
func (*Synchronizer) InitChain ¶
func (b *Synchronizer) InitChain(block *Block)
func (*Synchronizer) NewHsInfo ¶
func (b *Synchronizer) NewHsInfo() (*HandShakeInfo, error)
func (*Synchronizer) NewHsReq ¶
func (b *Synchronizer) NewHsReq(fetchRange *BlocksRange) (*HandShakeRequest, error)
type TxnsRequest ¶
func DecodeTxnsRequest ¶
func DecodeTxnsRequest(data []byte) (tr TxnsRequest, err error)
func (TxnsRequest) Encode ¶
func (tr TxnsRequest) Encode() ([]byte, error)
Click to show internal directories.
Click to hide internal directories.