Documentation
¶
Overview ¶
Package network contains the implementation of network protocol handler for fractal.
Index ¶
- Constants
- Variables
- type ErrCode
- type FetchBlockRsp
- type GetBlocksData
- type HashElem
- type HashElems
- type IntervalHashReq
- type NewBlockData
- type StatusData
- type SyncBlocksReq
- type SyncBlocksRsp
- type SyncHashListReq
- type SyncHashListRsp
- type SyncHashType
- type SyncPkgsReq
- type SyncPkgsRsp
- type SyncStage
Constants ¶
View Source
const ( // Protocol messages belonging to ftl1 StatusMsg = 0x00 // for block propagation NewBlockMsg = 0x01 // GetBlocksMsg = 0x02 BlocksMsg = 0x03 // for tx propagation TxMsg = 0x04 // for tx package propagation TxPackageHashMsg = 0x05 GetTxPackageMsg = 0x06 TxPackageMsg = 0x07 // for state sync GetNodeDataMsg = 0x08 NodeDataMsg = 0x09 // for hash list (cp2fp, fastsync, peersync) SyncHashListReqMsg = 0x0a SyncHashListResMsg = 0x0b // for pre blocks sync SyncPreBlocksForStateReqMsg = 0x0c SyncPreBlocksForStateRspMsg = 0x0d // for post blocks sync SyncPostBlocksForStateReqMsg = 0x0e SyncPostBlocksForStateRspMsg = 0x0f // for block sync (cp2fp, fastsync, peersync) GetPkgsForBlockSyncMsg = 0x10 PkgsForBlockSyncMsg = 0x11 GetBlocksForBlockSyncMsg = 0x12 BlocksForBlockSyncMsg = 0x13 )
ftl protocol message codes
View Source
const ( ErrMsgTooLarge = iota ErrDecode ErrInvalidMsgCode ErrProtocolVersionMismatch ErrNetworkIdMismatch ErrGenesisBlockMismatch ErrNoStatusMsg ErrExtraStatusMsg ErrSuspendedPeer ErrInvalidRepSyncBlockMsg )
View Source
const ProtocolMaxMsgSize = 512 * 1024 * 1024 // Maximum cap on the size of a protocol message
Variables ¶
View Source
var ProtocolLengths = []uint64{20}
ProtocolLengths are the number of implemented message corresponding to different protocol versions.
View Source
var ProtocolName = "ftl"
ProtocolName is the official short name of the protocol used during capability negotiation.
View Source
var ProtocolVersions = []uint{ftl2}
ProtocolVersions are the upported versions of the ftl protocol (first is primary).
Functions ¶
This section is empty.
Types ¶
type FetchBlockRsp ¶
type GetBlocksData ¶
type GetBlocksData struct { OriginHash common.Hash // block from which to retrieve Blocks Depth uint64 Reverse bool RoundFrom uint64 // block from which to retrieve Blocks RoundTo uint64 // block to which to retrieve Blocks }
getBlocksData represents a block query.
type IntervalHashReq ¶
type NewBlockData ¶
newBlockData is the network packet for the block propagation message.
type StatusData ¶
type StatusData struct { ProtocolVersion uint32 NetworkId uint64 Round uint64 Height uint64 CurrentFullHash common.Hash CurrentSimpleHash common.Hash GenesisHash common.Hash }
statusData is the network packet for the status message.
type SyncBlocksReq ¶
type SyncBlocksRsp ¶
type SyncHashListReq ¶
type SyncHashListRsp ¶
type SyncHashListRsp struct { Stage SyncStage Type SyncHashType Hashes HashElems }
type SyncHashType ¶
type SyncHashType byte
const ( SyncHashTypeBegin SyncHashType = iota SyncHashTypeLong SyncHashTypeShort SyncHashTypeEnd )
func (SyncHashType) String ¶
func (s SyncHashType) String() string
type SyncPkgsReq ¶
type SyncPkgsRsp ¶
type SyncPkgsRsp struct { Stage SyncStage Pkgs types.TxPackages }
Click to show internal directories.
Click to hide internal directories.