mempoolv1

package
v1.0.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 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 MemPool

type MemPool[VoteRank spenddag.VoteRankType[VoteRank]] struct {
	// contains filtered or unexported fields
}

MemPool is a component that manages the state of transactions that are not yet included in the ledger state.

func New

func New[VoteRank spenddag.VoteRankType[VoteRank]](
	vm mempool.VM,
	stateResolver mempool.StateResolver,
	mutationsFunc func(iotago.SlotIndex) (kvstore.KVStore, error),
	spendDAG spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, VoteRank],
	apiProvider iotago.APIProvider,
	errorHandler func(error),
	opts ...options.Option[MemPool[VoteRank]],
) *MemPool[VoteRank]

New is the constructor of the MemPool.

func (*MemPool[VoteRank]) AttachSignedTransaction

func (m *MemPool[VoteRank]) AttachSignedTransaction(signedTransaction mempool.SignedTransaction, transaction mempool.Transaction, blockID iotago.BlockID) (signedTransactionMetadata mempool.SignedTransactionMetadata, err error)

AttachSignedTransaction adds a transaction to the MemPool that was attached by the given block.

func (*MemPool[VoteRank]) CommitStateDiff

func (m *MemPool[VoteRank]) CommitStateDiff(slot iotago.SlotIndex) (mempool.StateDiff, error)

CommitStateDiff commits the state diff for the given slot so that it cannot be modified anymore and returns it.

func (*MemPool[VoteRank]) Evict

func (m *MemPool[VoteRank]) Evict(slot iotago.SlotIndex)

Evict evicts the slot with the given slot from the MemPool.

func (*MemPool[VoteRank]) InjectRequestedState

func (m *MemPool[VoteRank]) InjectRequestedState(state mempool.State)

InjectRequestedState allows to inject a requested state into the MemPool that is provided on the fly instead of being provided by the ledger.

func (*MemPool[VoteRank]) MarkAttachmentIncluded

func (m *MemPool[VoteRank]) MarkAttachmentIncluded(blockID iotago.BlockID) bool

MarkAttachmentIncluded marks the attachment of the given block as included.

func (*MemPool[VoteRank]) OnAttachTransactionFailed

func (m *MemPool[VoteRank]) OnAttachTransactionFailed(handler func(iotago.TransactionID, iotago.BlockID, error), opts ...event.Option) *event.Hook[func(iotago.TransactionID, iotago.BlockID, error)]

func (*MemPool[VoteRank]) OnSignedTransactionAttached

func (m *MemPool[VoteRank]) OnSignedTransactionAttached(handler func(signedTransactionMetadata mempool.SignedTransactionMetadata), opts ...event.Option) *event.Hook[func(metadata mempool.SignedTransactionMetadata)]

func (*MemPool[VoteRank]) OnTransactionAttached

func (m *MemPool[VoteRank]) OnTransactionAttached(handler func(transaction mempool.TransactionMetadata), opts ...event.Option) *event.Hook[func(metadata mempool.TransactionMetadata)]

func (*MemPool[VoteRank]) Reset

func (m *MemPool[VoteRank]) Reset()

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

func (*MemPool[VoteRank]) StateMetadata

func (m *MemPool[VoteRank]) StateMetadata(stateReference mempool.StateReference) (state mempool.StateMetadata, err error)

StateMetadata returns the metadata of the output state with the given ID.

func (*MemPool[VoteRank]) TransactionMetadata

func (m *MemPool[VoteRank]) TransactionMetadata(id iotago.TransactionID) (transaction mempool.TransactionMetadata, exists bool)

TransactionMetadata returns the metadata of the transaction with the given ID.

func (*MemPool[VoteRank]) TransactionMetadataByAttachment

func (m *MemPool[VoteRank]) TransactionMetadataByAttachment(blockID iotago.BlockID) (mempool.TransactionMetadata, bool)

TransactionMetadataByAttachment returns the metadata of the transaction that was attached by the given block.

func (*MemPool[VoteRank]) VM

func (m *MemPool[VoteRank]) VM() mempool.VM

type SignedTransactionMetadata

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

func NewSignedTransactionMetadata

func NewSignedTransactionMetadata(signedTransaction mempool.SignedTransaction, transactionMetadata *TransactionMetadata) *SignedTransactionMetadata

func (*SignedTransactionMetadata) Attachments

func (s *SignedTransactionMetadata) Attachments() []iotago.BlockID

func (*SignedTransactionMetadata) ID

func (*SignedTransactionMetadata) IsEvicted

func (s *SignedTransactionMetadata) IsEvicted() bool

func (*SignedTransactionMetadata) OnEvicted

func (s *SignedTransactionMetadata) OnEvicted(callback func())

func (*SignedTransactionMetadata) OnSignaturesInvalid

func (s *SignedTransactionMetadata) OnSignaturesInvalid(callback func(error)) (unsubscribe func())

func (*SignedTransactionMetadata) OnSignaturesValid

func (s *SignedTransactionMetadata) OnSignaturesValid(callback func()) (unsubscribe func())

func (*SignedTransactionMetadata) SignaturesInvalid

func (s *SignedTransactionMetadata) SignaturesInvalid() error

func (*SignedTransactionMetadata) SignedTransaction

func (s *SignedTransactionMetadata) SignedTransaction() mempool.SignedTransaction

func (*SignedTransactionMetadata) TransactionMetadata

func (s *SignedTransactionMetadata) TransactionMetadata() mempool.TransactionMetadata

type StateDiff

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

func NewStateDiff

func NewStateDiff(slot iotago.SlotIndex, kv kvstore.KVStore) *StateDiff

func (*StateDiff) AddTransaction

func (s *StateDiff) AddTransaction(transaction *TransactionMetadata) error

func (*StateDiff) CreatedStates

func (*StateDiff) DestroyedStates

func (*StateDiff) ExecutedTransactions

func (*StateDiff) Mutations

func (*StateDiff) Reset

func (s *StateDiff) Reset() error

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

func (*StateDiff) RollbackTransaction

func (s *StateDiff) RollbackTransaction(transaction *TransactionMetadata) error

func (*StateDiff) Slot

func (s *StateDiff) Slot() iotago.SlotIndex

type StateMetadata

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

func NewStateMetadata

func NewStateMetadata(state mempool.State, optSource ...*TransactionMetadata) *StateMetadata

func (*StateMetadata) AcceptedSpender

func (s *StateMetadata) AcceptedSpender() (mempool.TransactionMetadata, bool)

func (*StateMetadata) AllSpendersRemoved

func (s *StateMetadata) AllSpendersRemoved() bool

func (StateMetadata) CommittedSlot

func (s StateMetadata) CommittedSlot() (slot iotago.SlotIndex, isCommitted bool)

CommittedSlot returns the slot in which the entity is committed and a bool value indicating if the entity was committed.

func (*StateMetadata) HasNoSpenders

func (s *StateMetadata) HasNoSpenders() bool

func (*StateMetadata) InclusionSlot

func (s *StateMetadata) InclusionSlot() iotago.SlotIndex

func (StateMetadata) IsAccepted

func (s StateMetadata) IsAccepted() bool

IsAccepted returns true if the entity was accepted.

func (*StateMetadata) IsDoubleSpent

func (s *StateMetadata) IsDoubleSpent() bool

func (StateMetadata) IsPending

func (s StateMetadata) IsPending() bool

func (StateMetadata) IsRejected

func (s StateMetadata) IsRejected() bool

IsRejected returns true if the entity was rejected.

func (StateMetadata) OnAccepted

func (s StateMetadata) OnAccepted(callback func())

OnAccepted registers a callback that gets triggered when the entity gets accepted.

func (*StateMetadata) OnAcceptedSpenderUpdated

func (s *StateMetadata) OnAcceptedSpenderUpdated(callback func(spender mempool.TransactionMetadata))

func (StateMetadata) OnCommittedSlotUpdated

func (s StateMetadata) OnCommittedSlotUpdated(callback func(slot iotago.SlotIndex))

OnCommittedSlotUpdated registers a callback that gets triggered when the slot in which the entity is committed gets updated..

func (*StateMetadata) OnDoubleSpent

func (s *StateMetadata) OnDoubleSpent(callback func())

func (*StateMetadata) OnInclusionSlotUpdated

func (s *StateMetadata) OnInclusionSlotUpdated(callback func(prevID iotago.SlotIndex, newID iotago.SlotIndex))

func (StateMetadata) OnOrphanedSlotUpdated

func (s StateMetadata) OnOrphanedSlotUpdated(callback func(slot iotago.SlotIndex))

OnOrphanedSlotUpdated registers a callback that gets triggered when the orphaned slot is updated.

func (StateMetadata) OnRejected

func (s StateMetadata) OnRejected(callback func())

OnRejected registers a callback that gets triggered when the entity gets rejected.

func (*StateMetadata) OnSpendCommitted

func (s *StateMetadata) OnSpendCommitted(callback func(spender mempool.TransactionMetadata))

func (StateMetadata) OrphanedSlot

func (s StateMetadata) OrphanedSlot() (slot iotago.SlotIndex, isOrphaned bool)

OrphanedSlot returns a slot in which the entity has been orphaned and a bool flag indicating whether it was orphaned.

func (*StateMetadata) PendingSpenderCount

func (s *StateMetadata) PendingSpenderCount() int

func (*StateMetadata) SpenderIDs

func (s *StateMetadata) SpenderIDs() reactive.Set[iotago.TransactionID]

func (*StateMetadata) State

func (s *StateMetadata) State() mempool.State

type TransactionMetadata

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

func NewTransactionMetadata

func NewTransactionMetadata(transaction mempool.Transaction, referencedInputs []mempool.StateReference) *TransactionMetadata

func (*TransactionMetadata) AllInputsAccepted

func (t *TransactionMetadata) AllInputsAccepted() bool

func (*TransactionMetadata) Commit

func (t *TransactionMetadata) Commit()

func (TransactionMetadata) CommittedSlot

func (s TransactionMetadata) CommittedSlot() (slot iotago.SlotIndex, isCommitted bool)

CommittedSlot returns the slot in which the entity is committed and a bool value indicating if the entity was committed.

func (*TransactionMetadata) EarliestIncludedAttachment

func (t *TransactionMetadata) EarliestIncludedAttachment() iotago.BlockID

func (*TransactionMetadata) ID

func (*TransactionMetadata) Inputs

func (TransactionMetadata) IsAccepted

func (s TransactionMetadata) IsAccepted() bool

IsAccepted returns true if the entity was accepted.

func (*TransactionMetadata) IsBooked

func (t *TransactionMetadata) IsBooked() bool

func (*TransactionMetadata) IsConflictAccepted

func (t *TransactionMetadata) IsConflictAccepted() bool

func (*TransactionMetadata) IsEvicted

func (t *TransactionMetadata) IsEvicted() bool

func (*TransactionMetadata) IsExecuted

func (t *TransactionMetadata) IsExecuted() bool

func (*TransactionMetadata) IsInvalid

func (t *TransactionMetadata) IsInvalid() bool

func (TransactionMetadata) IsPending

func (s TransactionMetadata) IsPending() bool

func (TransactionMetadata) IsRejected

func (s TransactionMetadata) IsRejected() bool

IsRejected returns true if the entity was rejected.

func (*TransactionMetadata) IsSolid

func (t *TransactionMetadata) IsSolid() bool

func (TransactionMetadata) OnAccepted

func (s TransactionMetadata) OnAccepted(callback func())

OnAccepted registers a callback that gets triggered when the entity gets accepted.

func (*TransactionMetadata) OnBooked

func (t *TransactionMetadata) OnBooked(callback func())

func (TransactionMetadata) OnCommittedSlotUpdated

func (s TransactionMetadata) OnCommittedSlotUpdated(callback func(slot iotago.SlotIndex))

OnCommittedSlotUpdated registers a callback that gets triggered when the slot in which the entity is committed gets updated..

func (*TransactionMetadata) OnConflictAccepted

func (t *TransactionMetadata) OnConflictAccepted(callback func())

func (*TransactionMetadata) OnEarliestIncludedAttachmentUpdated

func (t *TransactionMetadata) OnEarliestIncludedAttachmentUpdated(callback func(prevBlock, newBlock iotago.BlockID))

func (*TransactionMetadata) OnEvicted

func (t *TransactionMetadata) OnEvicted(callback func())

func (*TransactionMetadata) OnExecuted

func (t *TransactionMetadata) OnExecuted(callback func())

func (*TransactionMetadata) OnInvalid

func (t *TransactionMetadata) OnInvalid(callback func(error))

func (TransactionMetadata) OnOrphanedSlotUpdated

func (s TransactionMetadata) OnOrphanedSlotUpdated(callback func(slot iotago.SlotIndex))

OnOrphanedSlotUpdated registers a callback that gets triggered when the orphaned slot is updated.

func (TransactionMetadata) OnRejected

func (s TransactionMetadata) OnRejected(callback func())

OnRejected registers a callback that gets triggered when the entity gets rejected.

func (*TransactionMetadata) OnSolid

func (t *TransactionMetadata) OnSolid(callback func())

func (TransactionMetadata) OrphanedSlot

func (s TransactionMetadata) OrphanedSlot() (slot iotago.SlotIndex, isOrphaned bool)

OrphanedSlot returns a slot in which the entity has been orphaned and a bool flag indicating whether it was orphaned.

func (*TransactionMetadata) Outputs

func (*TransactionMetadata) SpenderIDs

func (*TransactionMetadata) Transaction

func (t *TransactionMetadata) Transaction() mempool.Transaction

func (*TransactionMetadata) ValidAttachments

func (t *TransactionMetadata) ValidAttachments() []iotago.BlockID

Jump to

Keyboard shortcuts

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