inmemoryblockdag

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: Apache-2.0, BSD-2-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultTestFramework

func NewDefaultTestFramework(t *testing.T, workers *workerpool.Group, optsBlockDAG ...options.Option[BlockDAG]) *blockdag.TestFramework

Types

type BlockDAG

type BlockDAG struct {
	Workers *workerpool.Group

	module.Module
	// contains filtered or unexported fields
}

BlockDAG is a causally ordered DAG that forms the central data structure of the ZIPP protocol.

func New

func New(workers *workerpool.Group, evictionState *eviction.State, slotTimeProviderFunc func() *slot.TimeProvider, latestCommitmentFunc func(slot.Index) (*commitment.Commitment, error), opts ...options.Option[BlockDAG]) (newBlockDAG *BlockDAG)

New is the constructor for the BlockDAG and creates a new BlockDAG instance.

func NewTestBlockDAG

func NewTestBlockDAG(t *testing.T, workers *workerpool.Group, evictionState *eviction.State, slotTimeProvider *slot.TimeProvider, commitmentLoadFunc func(index slot.Index) (commitment *commitment.Commitment, err error), optsBlockDAG ...options.Option[BlockDAG]) *BlockDAG

func (*BlockDAG) Attach

func (b *BlockDAG) Attach(data *models.Block) (block *blockdag.Block, wasAttached bool, err error)

Attach is used to attach new Blocks to the BlockDAG. It is the main function of the BlockDAG that triggers Events.

func (*BlockDAG) Block

func (b *BlockDAG) Block(id models.BlockID) (block *blockdag.Block, exists bool)

Block retrieves a Block with metadata from the in-memory storage of the BlockDAG.

func (*BlockDAG) Events

func (b *BlockDAG) Events() *blockdag.Events

func (*BlockDAG) EvictionState

func (b *BlockDAG) EvictionState() *eviction.State

func (*BlockDAG) PromoteFutureBlocksUntil

func (b *BlockDAG) PromoteFutureBlocksUntil(index slot.Index)

func (*BlockDAG) SetInvalid

func (b *BlockDAG) SetInvalid(block *blockdag.Block, reason error) (wasUpdated bool)

SetInvalid marks a Block as invalid and propagates the invalidity to its future cone.

func (*BlockDAG) SetOrphaned

func (b *BlockDAG) SetOrphaned(block *blockdag.Block, orphaned bool) (updated bool)

SetOrphaned marks a Block as orphaned and propagates it to its future cone.

func (*BlockDAG) SlotTimeProvider

func (b *BlockDAG) SlotTimeProvider() *slot.TimeProvider

Jump to

Keyboard shortcuts

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