tipmanager

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: Apache-2.0, BSD-2-Clause Imports: 48 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) {
	return &Events{
		TipAdded:   event.New1[*scheduler.Block](),
		TipRemoved: event.New1[*scheduler.Block](),
	}
})

NewEvents contains the constructor of the Events object (it is generated by a generic factory).

Functions

func WithEngineOptions

func WithEngineOptions(opts ...options.Option[engine.Engine]) options.Option[TestFramework]

func WithGenesisUnixTime

func WithGenesisUnixTime(unixTime int64) options.Option[TestFramework]

func WithTimeSinceConfirmationThreshold

func WithTimeSinceConfirmationThreshold(timeSinceConfirmationThreshold time.Duration) options.Option[TipManager]

WithTimeSinceConfirmationThreshold returns an option that sets the time since confirmation threshold.

func WithTipManagerOptions

func WithTipManagerOptions(opts ...options.Option[TipManager]) options.Option[TestFramework]

func WithWidth

func WithWidth(maxWidth int) options.Option[TipManager]

WithWidth returns an option that configures the TipManager to maintain a certain width of the mesh.

Types

type Events

type Events struct {
	// Fired when a tip is added.
	TipAdded *event.Event1[*scheduler.Block]

	// Fired when a tip is removed.
	TipRemoved *event.Event1[*scheduler.Block]

	event.Group[Events, *Events]
}

Events represents events happening on the TipManager.

type TestFramework

type TestFramework struct {
	Instance *TipManager
	Engine   *engine.Engine
	Mesh     *mesh.TestFramework
	// contains filtered or unexported fields
}

func NewTestFramework

func NewTestFramework(test *testing.T, workers *workerpool.Group, opts ...options.Option[TestFramework]) (t *TestFramework)

func (*TestFramework) AssertEqualBlocks

func (t *TestFramework) AssertEqualBlocks(actualBlocks, expectedBlocks models.BlockIDs)

func (*TestFramework) AssertIsPastConeTimestampCorrect

func (t *TestFramework) AssertIsPastConeTimestampCorrect(blockAlias string, expected bool)

func (*TestFramework) AssertTipCount

func (t *TestFramework) AssertTipCount(expectedTipCount int)

func (*TestFramework) AssertTips

func (t *TestFramework) AssertTips(expectedTips models.BlockIDs)

func (*TestFramework) AssertTipsAdded

func (t *TestFramework) AssertTipsAdded(count uint32)

func (*TestFramework) AssertTipsRemoved

func (t *TestFramework) AssertTipsRemoved(count uint32)

func (*TestFramework) FormCommitment

func (t *TestFramework) FormCommitment(index slot.Index, acceptedBlocksAliases []string, prevIndex slot.Index) (cm *commitment.Commitment)

func (*TestFramework) IssueBlocksAndSetAccepted

func (t *TestFramework) IssueBlocksAndSetAccepted(aliases ...string)

func (*TestFramework) SetAcceptedTime

func (t *TestFramework) SetAcceptedTime(acceptedTime time.Time)

func (*TestFramework) SetBlocksAccepted

func (t *TestFramework) SetBlocksAccepted(aliases ...string)

func (*TestFramework) SetMarkersAccepted

func (t *TestFramework) SetMarkersAccepted(m ...markers.Marker)

func (*TestFramework) SlotTimeProvider

func (t *TestFramework) SlotTimeProvider() *slot.TimeProvider

type TipManager

type TipManager struct {
	Events *Events

	TipsConflictTracker *TipsConflictTracker
	// contains filtered or unexported fields
}

func New

func New(workers *workerpool.Group, schedulerBlockRetrieverFunc blockRetrieverFunc, opts ...options.Option[TipManager]) (t *TipManager)

New creates a new TipManager.

func (*TipManager) AddTip

func (t *TipManager) AddTip(block *scheduler.Block)

func (*TipManager) AddTipNonMonotonic

func (t *TipManager) AddTipNonMonotonic(block *scheduler.Block)

func (*TipManager) AllTips

func (t *TipManager) AllTips() (allTips []*scheduler.Block)

AllTips returns a list of all tips that are stored in the TipManger.

func (*TipManager) DeleteTip

func (t *TipManager) DeleteTip(block *scheduler.Block) (deleted bool)

func (*TipManager) EvictTSCCache

func (t *TipManager) EvictTSCCache(index slot.Index)

func (*TipManager) IsPastConeTimestampCorrect

func (t *TipManager) IsPastConeTimestampCorrect(block *booker.Block) (timestampValid bool)

func (*TipManager) LinkTo

func (t *TipManager) LinkTo(engine *engine.Engine)

func (*TipManager) RemoveStrongParents

func (t *TipManager) RemoveStrongParents(block *models.Block)

RemoveStrongParents removes all tips that are parents of the given block.

func (*TipManager) TipCount

func (t *TipManager) TipCount() int

TipCount the amount of tips.

func (*TipManager) Tips

func (t *TipManager) Tips(countParents int) (parents models.BlockIDs)

Tips returns count number of tips, maximum MaxParentsCount.

type TipsConflictTracker

type TipsConflictTracker struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewTipsConflictTracker

func NewTipsConflictTracker(workerPool *workerpool.WorkerPool, engineInstance *engine.Engine) *TipsConflictTracker

func (*TipsConflictTracker) AddTip

func (c *TipsConflictTracker) AddTip(block *scheduler.Block, blockConflictIDs utxo.TransactionIDs)

func (*TipsConflictTracker) Cleanup

func (c *TipsConflictTracker) Cleanup()

func (*TipsConflictTracker) MissingConflicts

func (c *TipsConflictTracker) MissingConflicts(amount int) (missingConflicts utxo.TransactionIDs)

func (*TipsConflictTracker) RemoveTip

func (c *TipsConflictTracker) RemoveTip(block *scheduler.Block)

Jump to

Keyboard shortcuts

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