ledger

package
v0.0.0-...-1c999d7 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionIDLength = 32
	OutputIDLength      = TransactionIDLength + 1
)
View Source
const MilestoneDeposit = 1000

Variables

View Source
var (
	GenesisOutputID          OutputID
	GenesisMilestoneOutputID = all32onesOutput()
	MilestoneChainID         [32]byte
)

GenesisOutputID, MilestoneChainID are all0 outputID GenesisMilestoneOutputID are all1

Functions

func MustOutputIDIndexFromBytes

func MustOutputIDIndexFromBytes(data []byte) (ret byte)

func OutputIDIndexFromBytes

func OutputIDIndexFromBytes(data []byte) (ret byte, err error)

OutputIDIndexFromBytes optimizes memory usage

Types

type IndexerReader

type IndexerReader interface {
	GetUTXOsLockedInAccount(accountID constraints.Accountable, state StateReader) ([]*OutputDataWithID, error)
	GetUTXOForChainID(id []byte, state StateReader) (*OutputDataWithID, error)
}

type IndexerStore

type IndexerStore interface {
	common.BatchedUpdatable
	common.Traversable
	common.KVReader
}

type OutputDataWithChainID

type OutputDataWithChainID struct {
	OutputDataWithID
	ChainID                    [32]byte
	PredecessorConstraintIndex byte
}

type OutputDataWithID

type OutputDataWithID struct {
	ID         OutputID
	OutputData []byte
}

type OutputID

type OutputID [OutputIDLength]byte

func MustOutputIDFromBytes

func MustOutputIDFromBytes(data []byte) (ret OutputID)

func NewOutputID

func NewOutputID(id *TransactionID, idx byte) (ret OutputID)

func OutputIDFromBytes

func OutputIDFromBytes(data []byte) (ret OutputID, err error)

func (*OutputID) Bytes

func (oid *OutputID) Bytes() []byte

func (*OutputID) Index

func (oid *OutputID) Index() byte

func (*OutputID) String

func (oid *OutputID) String() string

func (*OutputID) TransactionID

func (oid *OutputID) TransactionID() (ret TransactionID)

type StateReader

type StateReader interface {
	GetUTXO(id *OutputID) ([]byte, bool)
}

func StateReaderFromMap

func StateReaderFromMap(m map[OutputID][]byte) StateReader

type StateStore

type StateStore interface {
	common.KVReader
	common.BatchedUpdatable
}

type TransactionID

type TransactionID [TransactionIDLength]byte

func MustOutputIDTxIDFromBytes

func MustOutputIDTxIDFromBytes(data []byte) (ret TransactionID)

func OutputIDTxIDFromBytes

func OutputIDTxIDFromBytes(data []byte) (ret TransactionID, err error)

func TransactionIDFromBytes

func TransactionIDFromBytes(data []byte) (ret TransactionID, err error)

func (*TransactionID) Bytes

func (txid *TransactionID) Bytes() []byte

func (*TransactionID) Clone

func (txid *TransactionID) Clone() *TransactionID

func (*TransactionID) String

func (txid *TransactionID) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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