tipselectionv1

package
v1.0.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 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.

func WithMaxLikedInsteadReferences

func WithMaxLikedInsteadReferences(maxLikedInsteadReferences int) options.Option[TipSelection]

WithMaxLikedInsteadReferences is an option for the TipSelection that allows to configure the maximum number of liked instead references.

func WithMaxStrongParents

func WithMaxStrongParents(maxStrongParents int) options.Option[TipSelection]

WithMaxStrongParents is an option for the TipSelection that allows to configure the maximum number of strong parents.

func WithMaxWeakReferences

func WithMaxWeakReferences(maxWeakReferences int) options.Option[TipSelection]

WithMaxWeakReferences is an option for the TipSelection that allows to configure the maximum number of weak references.

Types

type TipSelection

type TipSelection struct {

	// Module embeds the required methods of the module.Interface.
	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(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(amount 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.

func (*TipSelection) Shutdown

func (t *TipSelection) Shutdown()

Shutdown triggers the shutdown of the TipSelection.

Jump to

Keyboard shortcuts

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