protocol

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SupportedVersions = Versions{2} // make sure to add the versions sorted asc
)

Functions

This section is empty.

Types

type Events

type Events struct {
	// Emits a protocol parameters milestone option for the unsupported milestone one milestone before.
	NextMilestoneUnsupported *event.Event1[*iotago.ProtocolParamsMilestoneOpt]
	// Emits critical errors.
	CriticalErrors *event.Event1[error]
}

Events are events happening around the Manager.

type Manager

type Manager struct {
	// Events holds the events happening within the Manager.
	Events *Events
	// contains filtered or unexported fields
}

Manager handles the knowledge about current, pending and supported protocol versions and parameters.

func NewManager

func NewManager(storage *storage.Storage, ledgerIndex iotago.MilestoneIndex) (*Manager, error)

NewManager creates a new Manager.

func (*Manager) Current

func (m *Manager) Current() *iotago.ProtocolParameters

Current returns the current protocol parameters under which the node is operating.

func (*Manager) HandleConfirmedMilestone

func (m *Manager) HandleConfirmedMilestone(milestonePayload *iotago.Milestone)

HandleConfirmedMilestone examines the newly confirmed milestone payload for protocol parameter changes.

func (*Manager) NextPendingSupported

func (m *Manager) NextPendingSupported() bool

NextPendingSupported tells whether the next pending protocol parameters changes are supported.

func (*Manager) Pending

func (m *Manager) Pending() []*iotago.ProtocolParamsMilestoneOpt

Pending returns the currently pending protocol changes.

func (*Manager) SupportedVersions

func (m *Manager) SupportedVersions() Versions

SupportedVersions returns a slice of supported protocol versions.

type Versions

type Versions []uint32

Versions is a slice of protocol versions.

func (Versions) Highest

func (v Versions) Highest() byte

Highest returns the highest version.

func (Versions) Lowest

func (v Versions) Lowest() byte

Lowest returns the lowest version.

func (Versions) Supports

func (v Versions) Supports(ver byte) bool

Supports tells whether the given version is supported.

Directories

Path Synopsis
tlv

Jump to

Keyboard shortcuts

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