Documentation ¶
Overview ¶
Package messages defines a sub-module to handle IBFT messages
Index ¶
- Variables
- func AreValidPCMessages(messages []*proto.Message, height uint64, roundLimit uint64) bool
- func ExtractCommitHash(commitMessage *proto.Message) []byte
- func ExtractLastPreparedProposal(roundChangeMessage *proto.Message) *proto.Proposal
- func ExtractLatestPC(roundChangeMessage *proto.Message) *proto.PreparedCertificate
- func ExtractPrepareHash(prepareMessage *proto.Message) []byte
- func ExtractProposal(proposalMessage *proto.Message) *proto.Proposal
- func ExtractProposalHash(proposalMessage *proto.Message) []byte
- func ExtractRoundChangeCertificate(proposalMessage *proto.Message) *proto.RoundChangeCertificate
- func HasUniqueSenders(messages []*proto.Message) bool
- type CommittedSeal
- type Messages
- func (ms *Messages) AddMessage(message *proto.Message)
- func (ms *Messages) Close()
- func (ms *Messages) GetExtendedRCC(height uint64, isValidMessage func(message *proto.Message) bool, ...) []*proto.Message
- func (ms *Messages) GetMostRoundChangeMessages(minRound, height uint64) []*proto.Message
- func (ms *Messages) GetValidMessages(view *proto.View, messageType proto.MessageType, ...) []*proto.Message
- func (ms *Messages) PruneByHeight(height uint64)
- func (ms *Messages) SignalEvent(messageType proto.MessageType, view *proto.View)
- func (ms *Messages) Subscribe(details SubscriptionDetails) *Subscription
- func (ms *Messages) Unsubscribe(id SubscriptionID)
- type Subscription
- type SubscriptionDetails
- type SubscriptionID
Constants ¶
This section is empty.
Variables ¶
var ( // ErrWrongCommitMessageType is an error indicating wrong type in commit messages ErrWrongCommitMessageType = errors.New("wrong type message is included in COMMIT messages") )
Functions ¶
func AreValidPCMessages ¶
AreValidPCMessages validates PreparedCertificate messages
func ExtractCommitHash ¶
ExtractCommitHash extracts the commit proposal hash from the passed in message
func ExtractLastPreparedProposal ¶
ExtractLastPreparedProposal extracts the latest prepared proposal from the passed in message
func ExtractLatestPC ¶
func ExtractLatestPC(roundChangeMessage *proto.Message) *proto.PreparedCertificate
ExtractLatestPC extracts the latest PC from the passed in message
func ExtractPrepareHash ¶
ExtractPrepareHash extracts the prepare proposal hash from the passed in message
func ExtractProposal ¶
ExtractProposal extracts the (rawData,r) proposal from the passed in message
func ExtractProposalHash ¶
ExtractProposalHash extracts the proposal hash from the passed in message
func ExtractRoundChangeCertificate ¶
func ExtractRoundChangeCertificate(proposalMessage *proto.Message) *proto.RoundChangeCertificate
ExtractRoundChangeCertificate extracts the RCC from the passed in message
func HasUniqueSenders ¶
HasUniqueSenders checks if the messages have unique senders
Types ¶
type CommittedSeal ¶
CommittedSeal Validator proof of signing a committed proposal
func ExtractCommittedSeal ¶
func ExtractCommittedSeal(commitMessage *proto.Message) *CommittedSeal
ExtractCommittedSeal extracts the committed seal from the passed in message
func ExtractCommittedSeals ¶
func ExtractCommittedSeals(commitMessages []*proto.Message) ([]*CommittedSeal, error)
ExtractCommittedSeals extracts the committed seals from the passed in messages
type Messages ¶
type Messages struct {
// contains filtered or unexported fields
}
Messages contains the relevant messages for each view (height, round)
func (*Messages) AddMessage ¶
AddMessage adds a new message to the message queue
func (*Messages) GetExtendedRCC ¶
func (ms *Messages) GetExtendedRCC( height uint64, isValidMessage func(message *proto.Message) bool, isValidRCC func(round uint64, messages []*proto.Message) bool, ) []*proto.Message
GetExtendedRCC returns Round-Change-Certificate for the highest round
func (*Messages) GetMostRoundChangeMessages ¶
GetMostRoundChangeMessages fetches most round change messages for the minimum round and above
func (*Messages) GetValidMessages ¶
func (ms *Messages) GetValidMessages( view *proto.View, messageType proto.MessageType, isValid func(message *proto.Message) bool, ) []*proto.Message
GetValidMessages fetches all messages of a specific type for the specified view, that pass the validity check; invalid messages are pruned out
func (*Messages) PruneByHeight ¶
PruneByHeight prunes out all old messages from the message queues by the specified height in the view
func (*Messages) SignalEvent ¶
func (ms *Messages) SignalEvent(messageType proto.MessageType, view *proto.View)
SignalEvent signals event
func (*Messages) Subscribe ¶
func (ms *Messages) Subscribe(details SubscriptionDetails) *Subscription
Subscribe creates a new message type subscription
func (*Messages) Unsubscribe ¶
func (ms *Messages) Unsubscribe(id SubscriptionID)
Unsubscribe cancels a message type subscription
type Subscription ¶
type Subscription struct { // ID is the unique identifier of the subscription ID SubscriptionID // SubCh is the notification channel // on which the listener will receive notifications SubCh chan uint64 }
Subscription is the subscription returned to the user
type SubscriptionDetails ¶
type SubscriptionDetails struct { // MessageType is the type of message // being subscribed to MessageType proto.MessageType // View is the combination of height + round // being subscribed to View *proto.View // MinNumMessages is the threshold of messages // being subscribed to MinNumMessages int // HasMinRound is the flag indicating if the // round number is a lower bound HasMinRound bool }
SubscriptionDetails contain the requested details for the subscription
type SubscriptionID ¶
type SubscriptionID int32
SubscriptionID is a unique number to identify Subscription