Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractRequestedMilestoneIndex(source []byte) (milestone.Index, error)
- func ExtractRequestedTransactionHash(source []byte) []byte
- 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 []byte) ([]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 << 1
FeatureSet denotes the version bit for STING support.
View Source
const FeatureSetName = "STING"
FeatureSetName is the name of the STING 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 and pruned milestone index. HeartbeatMessageDefinition = &message.Definition{ ID: MessageTypeHeartbeat, MaxBytesLength: HeartbeatMilestoneIndexBytesLength * 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 ExtractRequestedTransactionHash ¶
ExtractRequestedTransactionHash extracts the requested transaction hash from the given source.
func NewHeartbeatMessage ¶
func NewHeartbeatMessage(solidMilestoneIndex milestone.Index, prunedMilestoneIndex milestone.Index) ([]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.
func NewTransactionRequestMessage ¶
NewTransactionRequestMessage creates a transaction request message.
Types ¶
type Heartbeat ¶
type Heartbeat struct { SolidMilestoneIndex milestone.Index `json:"solid_milestone_index"` PrunedMilestoneIndex milestone.Index `json:"pruned_milestone_index"` }
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.