Documentation ¶
Index ¶
- type MemPool
- func (m *MemPool[VoteRank]) AttachSignedTransaction(signedTransaction mempool.SignedTransaction, transaction mempool.Transaction, ...) (signedTransactionMetadata mempool.SignedTransactionMetadata, err error)
- func (m *MemPool[VoteRank]) CommitStateDiff(slot iotago.SlotIndex) (mempool.StateDiff, error)
- func (m *MemPool[VoteRank]) Evict(slot iotago.SlotIndex)
- func (m *MemPool[VoteRank]) InjectRequestedState(state mempool.State)
- func (m *MemPool[VoteRank]) MarkAttachmentIncluded(blockID iotago.BlockID) bool
- func (m *MemPool[VoteRank]) OnAttachTransactionFailed(handler func(iotago.TransactionID, iotago.BlockID, error), ...) *event.Hook[func(iotago.TransactionID, iotago.BlockID, error)]
- func (m *MemPool[VoteRank]) OnSignedTransactionAttached(handler func(signedTransactionMetadata mempool.SignedTransactionMetadata), ...) *event.Hook[func(metadata mempool.SignedTransactionMetadata)]
- func (m *MemPool[VoteRank]) OnTransactionAttached(handler func(transaction mempool.TransactionMetadata), opts ...event.Option) *event.Hook[func(metadata mempool.TransactionMetadata)]
- func (m *MemPool[VoteRank]) Reset()
- func (m *MemPool[VoteRank]) StateMetadata(stateReference mempool.StateReference) (state mempool.StateMetadata, err error)
- func (m *MemPool[VoteRank]) TransactionMetadata(id iotago.TransactionID) (transaction mempool.TransactionMetadata, exists bool)
- func (m *MemPool[VoteRank]) TransactionMetadataByAttachment(blockID iotago.BlockID) (mempool.TransactionMetadata, bool)
- func (m *MemPool[VoteRank]) VM() mempool.VM
- type SignedTransactionMetadata
- func (s *SignedTransactionMetadata) Attachments() []iotago.BlockID
- func (s *SignedTransactionMetadata) ID() iotago.SignedTransactionID
- func (s *SignedTransactionMetadata) IsEvicted() bool
- func (s *SignedTransactionMetadata) OnEvicted(callback func())
- func (s *SignedTransactionMetadata) OnSignaturesInvalid(callback func(error)) (unsubscribe func())
- func (s *SignedTransactionMetadata) OnSignaturesValid(callback func()) (unsubscribe func())
- func (s *SignedTransactionMetadata) SignedTransaction() mempool.SignedTransaction
- func (s *SignedTransactionMetadata) TransactionMetadata() mempool.TransactionMetadata
- type StateDiff
- func (s *StateDiff) AddTransaction(transaction *TransactionMetadata) error
- func (s *StateDiff) CreatedStates() *shrinkingmap.ShrinkingMap[mempool.StateID, mempool.StateMetadata]
- func (s *StateDiff) DestroyedStates() *shrinkingmap.ShrinkingMap[mempool.StateID, mempool.StateMetadata]
- func (s *StateDiff) ExecutedTransactions() *orderedmap.OrderedMap[iotago.TransactionID, mempool.TransactionMetadata]
- func (s *StateDiff) Mutations() ads.Set[iotago.Identifier, iotago.TransactionID]
- func (s *StateDiff) Reset() error
- func (s *StateDiff) RollbackTransaction(transaction *TransactionMetadata) error
- func (s *StateDiff) Slot() iotago.SlotIndex
- type StateMetadata
- func (s *StateMetadata) AcceptedSpender() (mempool.TransactionMetadata, bool)
- func (s *StateMetadata) AllSpendersRemoved() bool
- func (s StateMetadata) CommittedSlot() (slot iotago.SlotIndex, isCommitted bool)
- func (s *StateMetadata) HasNoSpenders() bool
- func (s StateMetadata) IsAccepted() bool
- func (s *StateMetadata) IsDoubleSpent() bool
- func (s StateMetadata) IsPending() bool
- func (s StateMetadata) IsRejected() bool
- func (s StateMetadata) OnAccepted(callback func())
- func (s *StateMetadata) OnAcceptedSpenderUpdated(callback func(spender mempool.TransactionMetadata))
- func (s StateMetadata) OnCommittedSlotUpdated(callback func(slot iotago.SlotIndex))
- func (s *StateMetadata) OnDoubleSpent(callback func())
- func (s StateMetadata) OnOrphanedSlotUpdated(callback func(slot iotago.SlotIndex))
- func (s StateMetadata) OnRejected(callback func())
- func (s *StateMetadata) OnSpendCommitted(callback func(spender mempool.TransactionMetadata))
- func (s StateMetadata) OrphanedSlot() (slot iotago.SlotIndex, isOrphaned bool)
- func (s *StateMetadata) PendingSpenderCount() int
- func (s *StateMetadata) SpenderIDs() reactive.Set[iotago.TransactionID]
- func (s *StateMetadata) State() mempool.State
- type TransactionMetadata
- func (t *TransactionMetadata) AllInputsAccepted() bool
- func (t *TransactionMetadata) Commit()
- func (s TransactionMetadata) CommittedSlot() (slot iotago.SlotIndex, isCommitted bool)
- func (t *TransactionMetadata) EarliestIncludedAttachment() iotago.BlockID
- func (t *TransactionMetadata) ID() iotago.TransactionID
- func (t *TransactionMetadata) Inputs() ds.Set[mempool.StateMetadata]
- func (s TransactionMetadata) IsAccepted() bool
- func (t *TransactionMetadata) IsBooked() bool
- func (t *TransactionMetadata) IsConflictAccepted() bool
- func (t *TransactionMetadata) IsEvicted() bool
- func (t *TransactionMetadata) IsExecuted() bool
- func (t *TransactionMetadata) IsInvalid() bool
- func (s TransactionMetadata) IsPending() bool
- func (s TransactionMetadata) IsRejected() bool
- func (t *TransactionMetadata) IsSolid() bool
- func (s TransactionMetadata) OnAccepted(callback func())
- func (t *TransactionMetadata) OnBooked(callback func())
- func (s TransactionMetadata) OnCommittedSlotUpdated(callback func(slot iotago.SlotIndex))
- func (t *TransactionMetadata) OnConflictAccepted(callback func())
- func (t *TransactionMetadata) OnEarliestIncludedAttachmentUpdated(callback func(prevBlock, newBlock iotago.BlockID))
- func (t *TransactionMetadata) OnEvicted(callback func())
- func (t *TransactionMetadata) OnExecuted(callback func())
- func (t *TransactionMetadata) OnInvalid(callback func(error))
- func (s TransactionMetadata) OnOrphanedSlotUpdated(callback func(slot iotago.SlotIndex))
- func (s TransactionMetadata) OnRejected(callback func())
- func (t *TransactionMetadata) OnSolid(callback func())
- func (s TransactionMetadata) OrphanedSlot() (slot iotago.SlotIndex, isOrphaned bool)
- func (t *TransactionMetadata) Outputs() ds.Set[mempool.StateMetadata]
- func (t *TransactionMetadata) SpenderIDs() reactive.Set[iotago.TransactionID]
- func (t *TransactionMetadata) Transaction() mempool.Transaction
- func (t *TransactionMetadata) ValidAttachments() []iotago.BlockID
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 ¶
CommitStateDiff commits the state diff for the given slot so that it cannot be modified anymore and returns it.
func (*MemPool[VoteRank]) InjectRequestedState ¶
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 ¶
MarkAttachmentIncluded marks the attachment of the given block as included.
func (*MemPool[VoteRank]) OnAttachTransactionFailed ¶
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.
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 (s *SignedTransactionMetadata) ID() iotago.SignedTransactionID
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) 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 (*StateDiff) AddTransaction ¶
func (s *StateDiff) AddTransaction(transaction *TransactionMetadata) error
func (*StateDiff) CreatedStates ¶
func (s *StateDiff) CreatedStates() *shrinkingmap.ShrinkingMap[mempool.StateID, mempool.StateMetadata]
func (*StateDiff) DestroyedStates ¶
func (s *StateDiff) DestroyedStates() *shrinkingmap.ShrinkingMap[mempool.StateID, mempool.StateMetadata]
func (*StateDiff) ExecutedTransactions ¶
func (s *StateDiff) ExecutedTransactions() *orderedmap.OrderedMap[iotago.TransactionID, mempool.TransactionMetadata]
func (*StateDiff) Mutations ¶
func (s *StateDiff) Mutations() ads.Set[iotago.Identifier, iotago.TransactionID]
func (*StateDiff) Reset ¶
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
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 ¶
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) IsAccepted ¶
func (s StateMetadata) IsAccepted() bool
IsAccepted returns true if the entity was accepted.
func (*StateMetadata) IsDoubleSpent ¶
func (s *StateMetadata) IsDoubleSpent() 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 ¶
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) OnOrphanedSlotUpdated ¶
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 ¶
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 ¶
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 (t *TransactionMetadata) ID() iotago.TransactionID
func (*TransactionMetadata) Inputs ¶
func (t *TransactionMetadata) Inputs() ds.Set[mempool.StateMetadata]
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) 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 ¶
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 ¶
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 ¶
OrphanedSlot returns a slot in which the entity has been orphaned and a bool flag indicating whether it was orphaned.
func (*TransactionMetadata) Outputs ¶
func (t *TransactionMetadata) Outputs() ds.Set[mempool.StateMetadata]
func (*TransactionMetadata) SpenderIDs ¶
func (t *TransactionMetadata) SpenderIDs() reactive.Set[iotago.TransactionID]
func (*TransactionMetadata) Transaction ¶
func (t *TransactionMetadata) Transaction() mempool.Transaction
func (*TransactionMetadata) ValidAttachments ¶
func (t *TransactionMetadata) ValidAttachments() []iotago.BlockID