blocks

package
v1.0.0-alpha.13 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	// contains filtered or unexported fields
}

func NewBlock

func NewBlock(modelBlock *model.Block) *Block

NewBlock creates a new Block with the given options.

func NewMissingBlock

func NewMissingBlock(blockID iotago.BlockID) *Block

func NewRootBlock

func NewRootBlock(blockID iotago.BlockID, commitmentID iotago.CommitmentID, issuingTime time.Time) *Block

func (*Block) AcceptanceRatifiers

func (b *Block) AcceptanceRatifiers() ds.ReadableSet[account.SeatIndex]

func (*Block) Accepted

func (b *Block) Accepted() reactive.Variable[bool]

Accepted returns a reactive variable that is true if the Block was accepted.

func (*Block) AddAcceptanceRatifier

func (b *Block) AddAcceptanceRatifier(seat account.SeatIndex) (added bool)

func (*Block) AddConfirmationRatifier

func (b *Block) AddConfirmationRatifier(seat account.SeatIndex) (added bool)

func (*Block) AddWitness

func (b *Block) AddWitness(seat account.SeatIndex) (added bool)

func (*Block) AppendChild

func (b *Block) AppendChild(child *Block, childType iotago.ParentsType)

func (*Block) BasicBlock

func (b *Block) BasicBlock() (basicBlock *iotago.BasicBlockBody, isBasicBlock bool)

func (*Block) Booked

func (b *Block) Booked() reactive.Variable[bool]

Booked returns a reactive variable that is true if the Block was booked.

func (*Block) Children

func (b *Block) Children() ds.ReadableSet[*Block]

Children returns the children of the Block.

func (*Block) ConfirmationRatifiers

func (b *Block) ConfirmationRatifiers() ds.ReadableSet[account.SeatIndex]

func (*Block) ForEachParent

func (b *Block) ForEachParent(consumer func(parent iotago.Parent))

ForEachParent executes a consumer func for each parent.

func (*Block) ID

func (b *Block) ID() iotago.BlockID

func (*Block) Invalid

func (b *Block) Invalid() (invalid reactive.Variable[bool])

Invalid returns a reactive variable that is true if the Block was marked as invalid.

func (*Block) IsAccepted

func (b *Block) IsAccepted() bool

IsAccepted returns true if the Block was accepted.

func (*Block) IsBooked

func (b *Block) IsBooked() (isBooked bool)

func (*Block) IsConfirmed

func (b *Block) IsConfirmed() bool

func (*Block) IsDropped

func (b *Block) IsDropped() bool

IsDropped returns true if the Block was dropped.

func (*Block) IsEnqueued

func (b *Block) IsEnqueued() bool

IsEnqueued returns true if the Block is currently enqueued in the scheduler.

func (*Block) IsInvalid

func (b *Block) IsInvalid() (isInvalid bool)

IsInvalid returns true if the Block was marked as invalid.

func (*Block) IsMissing

func (b *Block) IsMissing() (isMissing bool)

IsMissing returns a flag that indicates if the underlying Block data hasn't been stored, yet.

func (*Block) IsNotarized

func (b *Block) IsNotarized() (isBooked bool)

func (*Block) IsPreAccepted

func (b *Block) IsPreAccepted() bool

IsPreAccepted returns true if the Block was preAccepted.

func (*Block) IsPreConfirmed

func (b *Block) IsPreConfirmed() bool

func (*Block) IsRootBlock

func (b *Block) IsRootBlock() bool

func (*Block) IsScheduled

func (b *Block) IsScheduled() bool

IsScheduled returns true if the Block was scheduled.

func (*Block) IsSkipped

func (b *Block) IsSkipped() bool

IsSkipped returns true if the Block was skipped.

func (*Block) IsSolid

func (b *Block) IsSolid() (isSolid bool)

IsSolid returns true if the Block is solid (the entire causal history is known).

func (*Block) IsWeightPropagated

func (b *Block) IsWeightPropagated() bool

func (*Block) IssuingTime

func (b *Block) IssuingTime() time.Time

func (*Block) ModelBlock

func (b *Block) ModelBlock() *model.Block

func (*Block) Notarized

func (b *Block) Notarized() reactive.Event

func (*Block) Parents

func (b *Block) Parents() (parents []iotago.BlockID)

func (*Block) ParentsWithType

func (b *Block) ParentsWithType() []iotago.Parent

ParentsWithType returns the parents of the block with their type.

func (*Block) Payload

func (b *Block) Payload() iotago.Payload

func (*Block) PayloadSpenderIDs

func (b *Block) PayloadSpenderIDs() ds.Set[iotago.TransactionID]

func (*Block) PreAccepted

func (b *Block) PreAccepted() reactive.Variable[bool]

PreAccepted returns a reactive variable that is true if the Block was pre accepted.

func (*Block) ProtocolBlock

func (b *Block) ProtocolBlock() *iotago.Block

func (*Block) SetAccepted

func (b *Block) SetAccepted() (wasUpdated bool)

SetAccepted sets the Block as accepted.

func (*Block) SetBooked

func (b *Block) SetBooked() (wasUpdated bool)

func (*Block) SetConfirmed

func (b *Block) SetConfirmed() (wasUpdated bool)

func (*Block) SetDropped

func (b *Block) SetDropped() (wasUpdated bool)

SetDropped sets the Block as dropped.

func (*Block) SetEnqueued

func (b *Block) SetEnqueued() (wasUpdated bool)

SetEnqueued sets the Block as enqueued.

func (*Block) SetInvalid

func (b *Block) SetInvalid() (wasUpdated bool)

SetInvalid marks the Block as invalid.

func (*Block) SetNotarized

func (b *Block) SetNotarized() (wasUpdated bool)

func (*Block) SetPayloadSpenderIDs

func (b *Block) SetPayloadSpenderIDs(payloadSpenderIDs ds.Set[iotago.TransactionID])

func (*Block) SetPreAccepted

func (b *Block) SetPreAccepted() (wasUpdated bool)

SetPreAccepted sets the Block as preAccepted.

func (*Block) SetPreConfirmed

func (b *Block) SetPreConfirmed() (wasUpdated bool)

func (*Block) SetScheduled

func (b *Block) SetScheduled() (wasUpdated bool)

SetScheduled sets the Block as scheduled.

func (*Block) SetSkipped

func (b *Block) SetSkipped() (wasUpdated bool)

SetSkipped sets the Block as skipped.

func (*Block) SetSolid

func (b *Block) SetSolid() (wasUpdated bool)

SetSolid marks the Block as solid.

func (*Block) SetSpenderIDs

func (b *Block) SetSpenderIDs(spenderIDs ds.Set[iotago.TransactionID])

func (*Block) SetWeightPropagated

func (b *Block) SetWeightPropagated() (wasUpdated bool)

func (*Block) ShallowLikeChildren

func (b *Block) ShallowLikeChildren() []*Block

func (*Block) SignedTransaction

func (b *Block) SignedTransaction() (tx *iotago.SignedTransaction, hasTransaction bool)

func (*Block) SlotCommitmentID

func (b *Block) SlotCommitmentID() iotago.CommitmentID

func (*Block) Solid

func (b *Block) Solid() (solid reactive.Variable[bool])

Solid returns a reactive variable that is true if the Block is solid (the entire causal history is known).

func (*Block) SpenderIDs

func (b *Block) SpenderIDs() ds.Set[iotago.TransactionID]

func (*Block) String

func (b *Block) String() string

func (*Block) StrongChildren

func (b *Block) StrongChildren() []*Block

func (*Block) StrongParents

func (b *Block) StrongParents() (parents []iotago.BlockID)

func (*Block) Update

func (b *Block) Update(modelBlock *model.Block) (wasPublished bool)

Update publishes the given Block data to the underlying Block and marks it as no longer missing.

func (*Block) ValidationBlock

func (b *Block) ValidationBlock() (validationBlock *iotago.ValidationBlockBody, isValidationBlock bool)

func (*Block) WeakChildren

func (b *Block) WeakChildren() []*Block

func (*Block) WeightPropagated

func (b *Block) WeightPropagated() reactive.Variable[bool]

func (*Block) WitnessCount

func (b *Block) WitnessCount() int

func (*Block) Witnesses

func (b *Block) Witnesses() ds.ReadableSet[account.SeatIndex]

func (*Block) WorkScore

func (b *Block) WorkScore() iotago.WorkScore

type Blocks

type Blocks struct {
	// contains filtered or unexported fields
}

func New

func New(evictionState *eviction.State, apiProvider iotago.APIProvider) *Blocks

func (*Blocks) Block

func (b *Blocks) Block(id iotago.BlockID) (block *Block, exists bool)

func (*Blocks) Evict

func (b *Blocks) Evict(slot iotago.SlotIndex)

func (*Blocks) GetOrCreate

func (b *Blocks) GetOrCreate(blockID iotago.BlockID, createFunc func() *Block) (block *Block, created bool)

func (*Blocks) Reset

func (b *Blocks) Reset()

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

func (*Blocks) StoreBlock

func (b *Blocks) StoreBlock(block *Block) (stored bool)

func (*Blocks) StoreOrUpdate

func (b *Blocks) StoreOrUpdate(modelBlock *model.Block) (storedBlock *Block, evicted bool, updated bool)

Jump to

Keyboard shortcuts

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