Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractRequestedMilestoneIndex(source []byte) (milestone.Index, error)
- func HeartbeatCaller(handler interface{}, params ...interface{})
- func NewHeartbeatMessage(solidMilestoneIndex milestone.Index, prunedMilestoneIndex milestone.Index, ...) ([]byte, error)
- func NewMilestoneRequestMessage(requestedMilestoneIndex milestone.Index) ([]byte, error)
- func NewTransactionMessage(txData []byte) ([]byte, error)
- func NewTransactionRequestMessage(requestedHash hornet.Hash) ([]byte, error)
- type Heartbeat
Constants ¶
View Source
const ( MessageTypeMilestoneRequest message.Type = 3 MessageTypeTransaction message.Type = 4 MessageTypeTransactionRequest message.Type = 5 MessageTypeHeartbeat message.Type = 6 )
View Source
const ( // The amount of bytes used for the requested transaction hash. RequestedTransactionHashMsgBytesLength = 49 // The amount of bytes used for the requested milestone index. RequestedMilestoneIndexMsgBytesLength = 4 // The amount of bytes used for a milestone index within a heartbeat packet. HeartbeatMilestoneIndexBytesLength = 4 // The index to use to request the latest milestone via a milestone request message. LatestMilestoneRequestIndex = 0 )
View Source
const FeatureSet = 1 << 2
FeatureSet denotes the version bit for Chrysalis-Pt1 support.
View Source
const FeatureSetName = "Chrysalis-Pt1"
FeatureSetName is the name of the feature set.
Variables ¶
View Source
var ( // TransactionMessageFormat defines a transaction message's format. TransactionMessageDefinition = &message.Definition{ ID: MessageTypeTransaction, MaxBytesLength: consts.NonSigTxPartBytesLength + consts.SigDataMaxBytesLength, VariableLength: true, } // The requested transaction hash gossipping packet. // Contains only a hash of a requested transaction payload. TransactionRequestMessageDefinition = &message.Definition{ ID: MessageTypeTransactionRequest, MaxBytesLength: RequestedTransactionHashMsgBytesLength, VariableLength: false, } // The heartbeat packet containing the current latest solid, pruned and latest milestone index, // number of connected neighbors and number of synced neighbors. HeartbeatMessageDefinition = &message.Definition{ ID: MessageTypeHeartbeat, MaxBytesLength: HeartbeatMilestoneIndexBytesLength*3 + 2, VariableLength: false, } // The requested milestone index packet. MilestoneRequestMessageDefinition = &message.Definition{ ID: MessageTypeMilestoneRequest, MaxBytesLength: RequestedMilestoneIndexMsgBytesLength, VariableLength: false, } )
View Source
var ( // ErrInvalidSourceLength is returned when an invalid source byte slice for extraction of certain data is passed. ErrInvalidSourceLength = errors.New("invalid source byte slice") )
Functions ¶
func ExtractRequestedMilestoneIndex ¶
ExtractRequestedMilestoneIndex extracts the requested milestone index from the given source.
func HeartbeatCaller ¶
func HeartbeatCaller(handler interface{}, params ...interface{})
func NewHeartbeatMessage ¶
func NewHeartbeatMessage(solidMilestoneIndex milestone.Index, prunedMilestoneIndex milestone.Index, latestMilestoneIndex milestone.Index, connectedNeighbors uint8, syncedNeighbors uint8) ([]byte, error)
NewHeartbeatMessage creates a new heartbeat message.
func NewMilestoneRequestMessage ¶
NewMilestoneRequestMessage creates a new milestone request message.
func NewTransactionMessage ¶
NewTransactionMessage creates a new transaction message.
Types ¶
type Heartbeat ¶
type Heartbeat struct { SolidMilestoneIndex milestone.Index `json:"solid_milestone_index"` PrunedMilestoneIndex milestone.Index `json:"pruned_milestone_index"` LatestMilestoneIndex milestone.Index `json:"latest_milestone_index"` ConnectedNeighbors int `json:"connected_neighbors"` SyncedNeighbors int `json:"synced_neighbors"` }
Heartbeat contains information about a nodes current solid and pruned milestone index.
func ParseHeartbeat ¶
/ ParseHeartbeat parses the given message into a heartbeat.
Click to show internal directories.
Click to hide internal directories.