messages

package
v1.1.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllHaveLowerRound

func AllHaveLowerRound(messages []*proto.Message, round uint64) bool

AllHaveLowerRound checks if all messages have the same round

func AllHaveSameHeight

func AllHaveSameHeight(messages []*proto.Message, height uint64) bool

AllHaveSameHeight checks if all messages have the same height

func ExtractCommitHash

func ExtractCommitHash(commitMessage *proto.Message) []byte

ExtractCommitHash extracts the commit proposal hash from the passed in message

func ExtractLastPreparedProposedBlock

func ExtractLastPreparedProposedBlock(roundChangeMessage *proto.Message) []byte

ExtractLastPreparedProposedBlock extracts the latest prepared proposed block 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

func ExtractPrepareHash(prepareMessage *proto.Message) []byte

ExtractPrepareHash extracts the prepare proposal hash from the passed in message

func ExtractProposal

func ExtractProposal(proposalMessage *proto.Message) []byte

ExtractProposal extracts the proposal from the passed in message

func ExtractProposalHash

func ExtractProposalHash(proposalMessage *proto.Message) []byte

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

func HasUniqueSenders(messages []*proto.Message) bool

HasUniqueSenders checks if the messages have unique senders

func HaveSameProposalHash

func HaveSameProposalHash(messages []*proto.Message) bool

HaveSameProposalHash checks if the messages have the same proposal hash

Types

type CommittedSeal

type CommittedSeal struct {
	Signer    []byte
	Signature []byte
}

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

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 NewMessages

func NewMessages() *Messages

NewMessages returns a new Messages wrapper

func (*Messages) AddMessage

func (ms *Messages) AddMessage(message *proto.Message)

AddMessage adds a new message to the message queue

func (*Messages) Close

func (ms *Messages) Close()

func (*Messages) GetMostRoundChangeMessages

func (ms *Messages) GetMostRoundChangeMessages(minRound, height uint64) []*proto.Message

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

func (ms *Messages) PruneByHeight(height uint64)

PruneByHeight prunes out all old messages from the message queues by the specified height in the view

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL