ledger

package
v1.0.0-beta.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) {
	return &Events{
		AccountCreated:   event.New1[iotago.AccountID](),
		AccountDestroyed: event.New1[iotago.AccountID](),
	}
})

NewEvents contains the constructor of the Events object (it is generated by a generic factory).

Functions

This section is empty.

Types

type BlockVoteRank

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

func NewBlockVoteRank

func NewBlockVoteRank(id iotago.BlockID, time time.Time) BlockVoteRank

func (BlockVoteRank) Compare

func (v BlockVoteRank) Compare(other BlockVoteRank) int

type Events

type Events struct {
	AccountCreated   *event.Event1[iotago.AccountID]
	AccountDestroyed *event.Event1[iotago.AccountID]

	event.Group[Events, *Events]
}

type Ledger

type Ledger interface {
	AttachTransaction(block *blocks.Block) (signedTransactionMetadata mempool.SignedTransactionMetadata, containsTransaction bool)
	OnTransactionAttached(callback func(transactionMetadata mempool.TransactionMetadata), opts ...event.Option) *event.Hook[func(metadata mempool.TransactionMetadata)]
	TransactionMetadata(id iotago.TransactionID) (transactionMetadata mempool.TransactionMetadata, exists bool)
	TransactionMetadataByAttachment(blockID iotago.BlockID) (transactionMetadata mempool.TransactionMetadata, exists bool)

	Account(accountID iotago.AccountID, targetSlot iotago.SlotIndex) (accountData *accounts.AccountData, exists bool, err error)
	PastAccounts(accountIDs iotago.AccountIDs, targetSlot iotago.SlotIndex) (pastAccountsData map[iotago.AccountID]*accounts.AccountData, err error)
	AddAccount(account *utxoledger.Output, credits iotago.BlockIssuanceCredits) error

	Output(id iotago.OutputID) (*utxoledger.Output, error)
	OutputOrSpent(id iotago.OutputID) (output *utxoledger.Output, spent *utxoledger.Spent, err error)
	ForEachUnspentOutput(consumer func(output *utxoledger.Output) bool) error
	AddGenesisUnspentOutput(unspentOutput *utxoledger.Output) error

	SpendDAG() spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, BlockVoteRank]
	MemPool() mempool.MemPool[BlockVoteRank]
	SlotDiffs(slot iotago.SlotIndex) (*utxoledger.SlotDiff, error)

	ManaManager() *mana.Manager
	RMCManager() *rmc.Manager

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

	Import(reader io.ReadSeeker) error
	Export(writer io.WriteSeeker, targetSlot iotago.SlotIndex) error
	TrackBlock(block *blocks.Block)

	AccountRoot() iotago.Identifier

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

	module.Module
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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