inmemoryblockdag

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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type BlockDAG

type BlockDAG struct {
	module.Module
	// contains filtered or unexported fields
}

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

func New

func New(subModule module.Module, workers *workerpool.Group, unsolidCommitmentBufferSize int, evictionState *eviction.State, blockCache *blocks.Blocks, errorHandler func(error), opts ...options.Option[BlockDAG]) (newBlockDAG *BlockDAG)

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

func (*BlockDAG) Append

func (b *BlockDAG) Append(modelBlock *model.Block) (block *blocks.Block, wasAppended bool, err error)

Append is used to append new Blocks to the BlockDAG. It is the main function of the BlockDAG that triggers Events.

func (*BlockDAG) GetOrRequestBlock

func (b *BlockDAG) GetOrRequestBlock(blockID iotago.BlockID) (block *blocks.Block, requested bool)

GetOrRequestBlock returns the Block with the given BlockID from the BlockDAG (and requests it from the network if it is missing). If the requested Block is below the eviction threshold, then this method will return a nil block without creating it.

func (*BlockDAG) Reset

func (b *BlockDAG) Reset()

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

Jump to

Keyboard shortcuts

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