ledger

package
v1.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProvider

func NewProvider() module.Provider[*engine.Engine, ledger.Ledger]

Types

type ExecutionContextKey

type ExecutionContextKey uint8

ExecutionContextKey is the type of the keys used in the execution context.

const (
	// ExecutionContextKeyUnlockedAddresses is the key for the unlocked addresses in the execution context.
	ExecutionContextKeyUnlockedAddresses ExecutionContextKey = iota

	// ExecutionContextKeyResolvedInputs is the key for the resolved inputs in the execution context.
	ExecutionContextKeyResolvedInputs
)

type Ledger

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

func New

func New(
	subModule module.Module,
	utxoLedger *utxoledger.Manager,
	accountsStore kvstore.KVStore,
	commitmentLoader func(iotago.SlotIndex) (*model.Commitment, error),
	blocksFunc func(id iotago.BlockID) (*blocks.Block, bool),
	slotDiffFunc func(iotago.SlotIndex) (*slotstore.AccountDiffs, error),
	apiProvider iotago.APIProvider,
	sybilProtection sybilprotection.SybilProtection,
	errorHandler func(error),
) *Ledger

func (*Ledger) Account

func (l *Ledger) Account(accountID iotago.AccountID, targetIndex iotago.SlotIndex) (accountData *accounts.AccountData, exists bool, err error)

func (*Ledger) AccountRoot

func (l *Ledger) AccountRoot() iotago.Identifier

func (*Ledger) AddAccount

func (l *Ledger) AddAccount(output *utxoledger.Output, blockIssuanceCredits iotago.BlockIssuanceCredits) error

func (*Ledger) AddGenesisUnspentOutput

func (l *Ledger) AddGenesisUnspentOutput(unspentOutput *utxoledger.Output) error

func (*Ledger) AttachTransaction

func (l *Ledger) AttachTransaction(block *blocks.Block) (attachedTransaction mempool.SignedTransactionMetadata, containsTransaction bool)

func (*Ledger) CommitSlot

func (l *Ledger) CommitSlot(slot iotago.SlotIndex) (stateRoot iotago.Identifier, mutationRoot iotago.Identifier, accountRoot iotago.Identifier, created utxoledger.Outputs, consumed utxoledger.Spents, mutations []*iotago.Transaction, err error)

func (*Ledger) Export

func (l *Ledger) Export(writer io.WriteSeeker, targetIndex iotago.SlotIndex) error

func (*Ledger) ForEachUnspentOutput

func (l *Ledger) ForEachUnspentOutput(consumer func(output *utxoledger.Output) bool) error

func (*Ledger) Import

func (l *Ledger) Import(reader io.ReadSeeker) error

func (*Ledger) ManaManager

func (l *Ledger) ManaManager() *mana.Manager

func (*Ledger) MemPool

func (l *Ledger) MemPool() mempool.MemPool[ledger.BlockVoteRank]

func (*Ledger) OnTransactionAttached

func (l *Ledger) OnTransactionAttached(handler func(transaction mempool.TransactionMetadata), opts ...event.Option) *event.Hook[func(metadata mempool.TransactionMetadata)]

func (*Ledger) Output

func (l *Ledger) Output(outputID iotago.OutputID) (*utxoledger.Output, error)

func (*Ledger) OutputOrSpent

func (l *Ledger) OutputOrSpent(outputID iotago.OutputID) (*utxoledger.Output, *utxoledger.Spent, error)

func (*Ledger) PastAccounts

func (l *Ledger) PastAccounts(accountIDs iotago.AccountIDs, targetIndex iotago.SlotIndex) (accountDataMap map[iotago.AccountID]*accounts.AccountData, err error)

func (*Ledger) RMCManager

func (l *Ledger) RMCManager() *rmc.Manager

func (*Ledger) Reset

func (l *Ledger) Reset()

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

func (*Ledger) SlotDiffs

func (l *Ledger) SlotDiffs(slot iotago.SlotIndex) (*utxoledger.SlotDiff, error)

func (*Ledger) TrackBlock

func (l *Ledger) TrackBlock(block *blocks.Block)

func (*Ledger) TransactionMetadata

func (l *Ledger) TransactionMetadata(transactionID iotago.TransactionID) (mempool.TransactionMetadata, bool)

func (*Ledger) TransactionMetadataByAttachment

func (l *Ledger) TransactionMetadataByAttachment(blockID iotago.BlockID) (mempool.TransactionMetadata, bool)

type VM

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

func NewVM

func NewVM(ledger *Ledger) *VM

func (*VM) Execute

func (v *VM) Execute(executionContext context.Context, transaction mempool.Transaction) (outputs []mempool.State, err error)

func (*VM) Inputs

func (v *VM) Inputs(transaction mempool.Transaction) (inputReferences []mempool.StateReference, err error)

func (*VM) ValidateSignatures

func (v *VM) ValidateSignatures(signedTransaction mempool.SignedTransaction, resolvedInputStates []mempool.State) (executionContext context.Context, err error)

Jump to

Keyboard shortcuts

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