tipselectionv1

package
v1.0.0-beta.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DynamicLivenessThreshold

func DynamicLivenessThreshold(committeeSizeProvider func() int) func(tip tipmanager.TipMetadata) time.Duration

DynamicLivenessThreshold returns a function that calculates the liveness threshold for a tip.

func NewProvider

NewProvider creates a new TipSelection provider, that can be used to inject the component into an engine.

Types

type TipSelection

type TipSelection struct {

	// Module embeds the required methods of the modular framework.
	module.Module
	// contains filtered or unexported fields
}

TipSelection is a component that is used to abstract away the tip selection strategy, used to issue new blocks.

func New

func New(subModule module.Module, opts ...options.Option[TipSelection]) *TipSelection

New is the constructor for the TipSelection.

func (*TipSelection) Construct

func (t *TipSelection) Construct(tipManager tipmanager.TipManager, spendDAG spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, ledger.BlockVoteRank], transactionMetadataRetriever func(iotago.TransactionID) (mempool.TransactionMetadata, bool), rootBlockRetriever func() iotago.BlockID, livenessThresholdFunc func(tipmanager.TipMetadata) time.Duration) *TipSelection

Construct fills in the dependencies of the TipSelection and triggers the constructed and initialized events of the module.

This method is separated from the constructor so the TipSelection can be initialized lazily after all dependencies are available.

func (*TipSelection) Reset

func (t *TipSelection) Reset()

Reset resets the component to a clean state as if it was created at the last commitment.

func (*TipSelection) SelectTips

func (t *TipSelection) SelectTips(maxStrongParents int, maxLikedInsteadParents int, maxWeakParents int) (references model.ParentReferences)

SelectTips selects the tips that should be used as references for a new block.

func (*TipSelection) SetAcceptanceTime

func (t *TipSelection) SetAcceptanceTime(acceptanceTime time.Time) (previousValue time.Time)

SetAcceptanceTime updates the acceptance time of the TipSelection.

Jump to

Keyboard shortcuts

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