milestonemanager

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MilestoneManager

type MilestoneManager struct {

	// events
	Events *packageEvents
	// contains filtered or unexported fields
}

MilestoneManager is used to retrieve, verify and store milestones.

func New

func New(
	dbStorage *storage.Storage,
	syncManager *syncmanager.SyncManager,
	keyManager *keymanager.KeyManager,
	milestonePublicKeyCount int) *MilestoneManager

func (*MilestoneManager) FindClosestNextMilestoneIndex

func (m *MilestoneManager) FindClosestNextMilestoneIndex(index iotago.MilestoneIndex) (iotago.MilestoneIndex, error)

FindClosestNextMilestoneIndex searches for the next known milestone in the persistence layer.

func (*MilestoneManager) KeyManager

func (m *MilestoneManager) KeyManager() *keymanager.KeyManager

KeyManager returns the used key manager.

func (*MilestoneManager) StoreMilestone

func (m *MilestoneManager) StoreMilestone(cachedBlock *storage.CachedBlock, milestonePayload *iotago.Milestone, requested bool)

StoreMilestone stores the milestone in the storage layer and triggers the ReceivedValidMilestone event.

func (*MilestoneManager) VerifyMilestoneBlock

func (m *MilestoneManager) VerifyMilestoneBlock(block *iotago.Block) *iotago.Milestone

VerifyMilestoneBlock checks if the block contains a valid milestone payload. Returns a milestone payload if the signature is valid.

func (*MilestoneManager) VerifyMilestonePayload

func (m *MilestoneManager) VerifyMilestonePayload(payload iotago.Payload) *iotago.Milestone

VerifyMilestonePayload checks if milestone payload is valid. Attention: It does not check if the milestone payload parents match the block parents. Returns a milestone payload if the signature is valid.

Jump to

Keyboard shortcuts

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