memdag

package
v0.4.3-testnet Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 21 Imported by: 0

README

Package memdag implements the MemDAG, a data structure which represents in-memory part of the UTXO tangle for being constructed and validated.

Transactions first appear as vertices of MemDAG, only after validation they are persisted to the TxBytesStore.

Proxima node does not have (and does not need) a mempool like the one used in the blockchain architectures with block proposers. _MemDAG _ plays similar role of the buffer before storing transaction and committing the ledger state.

Invalid, obsolete or irrelevant transactions ar constantly cleaned in the background.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeGraphPastCone

func MakeGraphPastCone(vid *vertex.WrappedTx, maxVertices ...int) graph.Graph[string, string]

func SaveGraphPastCone

func SaveGraphPastCone(vid *vertex.WrappedTx, fname string)

func SavePastConeFromTxStore

func SavePastConeFromTxStore(tip ledger.TransactionID, txStore global.TxBytesGet, oldestSlot ledger.Slot, fname string)

Types

type MemDAG

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

MemDAG is a global map of all in-memory vertices of the transaction DAG

func MakeDAGFromTxStore

func MakeDAGFromTxStore(txStore global.TxBytesGet, oldestSlot ledger.Slot, tips ...ledger.TransactionID) *MemDAG

MakeDAGFromTxStore creates dummy MemDAG from past cones of tips. Only uses txBytes from txStore It is used in testing, to visualize real transaction MemDAG, not the pruned cache kept in the node

func New

func New(env environment) *MemDAG

func (*MemDAG) AddVertexNoLock

func (d *MemDAG) AddVertexNoLock(vid *vertex.WrappedTx)

func (*MemDAG) CheckTransactionInLRB

func (d *MemDAG) CheckTransactionInLRB(txid ledger.TransactionID, maxDepth int) (lrbid ledger.TransactionID, foundAtDepth int)

func (*MemDAG) EvidenceBranchSlot

func (d *MemDAG) EvidenceBranchSlot(s ledger.Slot, isHealthy bool)

EvidenceBranchSlot maintains cached values

func (*MemDAG) FetchSummarySupplyAndInflation

func (d *MemDAG) FetchSummarySupplyAndInflation(nBack int) *multistate.SummarySupplyAndInflation

func (*MemDAG) GetStateReaderForTheBranch

func (d *MemDAG) GetStateReaderForTheBranch(branchID ledger.TransactionID) multistate.IndexedStateReader

func (*MemDAG) GetStemWrappedOutput

func (d *MemDAG) GetStemWrappedOutput(branch *ledger.TransactionID) (ret vertex.WrappedOutput)

func (*MemDAG) GetVertex

func (d *MemDAG) GetVertex(txid *ledger.TransactionID) *vertex.WrappedTx

func (*MemDAG) GetVertexNoLock

func (d *MemDAG) GetVertexNoLock(txid *ledger.TransactionID) *vertex.WrappedTx

func (*MemDAG) HeaviestStateForLatestTimeSlot

func (d *MemDAG) HeaviestStateForLatestTimeSlot() multistate.SugaredStateReader

func (*MemDAG) HeaviestStateForLatestTimeSlotWithBaseline

func (d *MemDAG) HeaviestStateForLatestTimeSlotWithBaseline() (multistate.SugaredStateReader, *vertex.WrappedTx)

func (*MemDAG) Info

func (d *MemDAG) Info(verbose ...bool) string

func (*MemDAG) InfoLines

func (d *MemDAG) InfoLines(verbose ...bool) *lines.Lines

func (*MemDAG) LatestBranchSlots

func (d *MemDAG) LatestBranchSlots() (slot, healthySlot ledger.Slot, synced bool)

LatestBranchSlots return latest committed slots and the sync flag. The latter indicates if current node is in sync with the network. If network is unreachable or nobody else is active it will return false Node is out of sync if current slots are behind from now Being synced or not is subjective

func (*MemDAG) LatestHealthySlot

func (d *MemDAG) LatestHealthySlot() ledger.Slot

func (*MemDAG) LatestReliableState

func (d *MemDAG) LatestReliableState() (multistate.SugaredStateReader, error)

func (*MemDAG) LinesVerticesInSlotAndAfter

func (d *MemDAG) LinesVerticesInSlotAndAfter(slot ledger.Slot) *lines.Lines

func (*MemDAG) MakeGraph

func (d *MemDAG) MakeGraph(additionalVertices ...*vertex.WrappedTx) graph.Graph[string, string]

func (*MemDAG) MakeSequencerGraph

func (d *MemDAG) MakeSequencerGraph() graph.Graph[string, string]

func (*MemDAG) MustLatestReliableState

func (d *MemDAG) MustLatestReliableState() multistate.SugaredStateReader

func (*MemDAG) NumStateReaders

func (d *MemDAG) NumStateReaders() int

func (*MemDAG) NumVertices

func (d *MemDAG) NumVertices() int

NumVertices number of vertices

func (*MemDAG) ParseMilestoneData

func (d *MemDAG) ParseMilestoneData(msVID *vertex.WrappedTx) (ret *ledger.MilestoneData)

func (*MemDAG) PurgeCachedStateReaders

func (d *MemDAG) PurgeCachedStateReaders() (int, int)

func (*MemDAG) PurgeDeletedVertices

func (d *MemDAG) PurgeDeletedVertices(deleted []*vertex.WrappedTx)

PurgeDeletedVertices with global lock

func (*MemDAG) QueryTxIDStatus

func (d *MemDAG) QueryTxIDStatus(txid *ledger.TransactionID) (ret vertex.TxIDStatus)

QueryTxIDStatus returns vertex mode, tx status and error of the vertex

func (*MemDAG) RecreateVertexMap

func (d *MemDAG) RecreateVertexMap()

RecreateVertexMap to avoid memory leak

func (*MemDAG) SaveGraph

func (d *MemDAG) SaveGraph(fname string)

func (*MemDAG) SaveSequencerGraph

func (d *MemDAG) SaveSequencerGraph(fname string)

func (*MemDAG) SaveTree

func (d *MemDAG) SaveTree(fname string)

func (*MemDAG) Vertices

func (d *MemDAG) Vertices() []*vertex.WrappedTx

Vertices to avoid global lock while traversing all utangle

func (*MemDAG) VerticesDescending

func (d *MemDAG) VerticesDescending() []*vertex.WrappedTx

func (*MemDAG) VerticesFiltered

func (d *MemDAG) VerticesFiltered(filterByID func(txid *ledger.TransactionID) bool) []*vertex.WrappedTx

func (*MemDAG) VerticesInSlotAndAfter

func (d *MemDAG) VerticesInSlotAndAfter(slot ledger.Slot) []*vertex.WrappedTx

func (*MemDAG) WaitUntilTransactionInHeaviestState

func (d *MemDAG) WaitUntilTransactionInHeaviestState(txid ledger.TransactionID, timeout ...time.Duration) (*vertex.WrappedTx, error)

WaitUntilTransactionInHeaviestState for testing mostly

func (*MemDAG) WithGlobalWriteLock

func (d *MemDAG) WithGlobalWriteLock(fun func())

Jump to

Keyboard shortcuts

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