accountsledger

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager is a Block Issuer Credits module responsible for tracking block issuance credit balances.

func New

func New(
	subModule module.Module,
	apiProvider iotago.APIProvider,
	blockFunc func(id iotago.BlockID) (*blocks.Block, bool),
	slotDiffFunc func(iotago.SlotIndex) (*slotstore.AccountDiffs, error),
	accountsStore kvstore.KVStore,
) *Manager

func (*Manager) Account

func (m *Manager) Account(accountID iotago.AccountID, targetSlot iotago.SlotIndex) (accountData *accounts.AccountData, exists bool, err error)

Account loads the account's data at a specific slot index.

func (*Manager) AccountsTreeRoot

func (m *Manager) AccountsTreeRoot() iotago.Identifier

AccountsTreeRoot returns the root of the Account tree with all the account ledger data.

func (*Manager) AddAccount

func (m *Manager) AddAccount(output *utxoledger.Output, blockIssuanceCredits iotago.BlockIssuanceCredits) error

AddAccount adds a new account to the Account tree, allotting to it the balance on the given output. The Account will be created associating the given output as the latest state of the account.

func (*Manager) ApplyDiff

func (m *Manager) ApplyDiff(
	slot iotago.SlotIndex,
	rmc iotago.Mana,
	accountDiffs map[iotago.AccountID]*model.AccountDiff,
	destroyedAccounts ds.Set[iotago.AccountID],
) error

ApplyDiff applies the given accountDiff to the Account tree.

func (*Manager) Export

func (m *Manager) Export(writer io.WriteSeeker, targetIndex iotago.SlotIndex) error

func (*Manager) Import

func (m *Manager) Import(reader io.ReadSeeker) error

func (*Manager) LoadSlotDiff

func (m *Manager) LoadSlotDiff(slot iotago.SlotIndex, accountID iotago.AccountID) (*model.AccountDiff, bool, error)

func (*Manager) PastAccounts

func (m *Manager) PastAccounts(accountIDs iotago.AccountIDs, targetSlot iotago.SlotIndex) (pastAccounts map[iotago.AccountID]*accounts.AccountData, err error)

PastAccounts loads the past accounts' data at a specific slot index.

func (*Manager) Reset

func (m *Manager) Reset()

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

func (*Manager) Rollback

func (m *Manager) Rollback(targetSlot iotago.SlotIndex) error

func (*Manager) SetLatestCommittedSlot

func (m *Manager) SetLatestCommittedSlot(slot iotago.SlotIndex)

func (*Manager) TrackBlock

func (m *Manager) TrackBlock(block *blocks.Block)

TrackBlock adds the block to the blockBurns set to deduct the burn from credits upon slot commitment and updates latest supported version of a validation block.

Jump to

Keyboard shortcuts

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