Documentation
¶
Index ¶
- Variables
- type Mempool
- func (m *Mempool) Add(tx *atomic.Tx) error
- func (m *Mempool) AddLocalTx(tx *atomic.Tx) error
- func (m *Mempool) AddRemoteTx(tx *atomic.Tx) error
- func (m *Mempool) CancelCurrentTx(txID ids.ID)
- func (m *Mempool) CancelCurrentTxs()
- func (m *Mempool) DiscardCurrentTx(txID ids.ID)
- func (m *Mempool) DiscardCurrentTxs()
- func (m *Mempool) ForceAddTx(tx *atomic.Tx) error
- func (m *Mempool) GetFilter() ([]byte, []byte)
- func (m *Mempool) GetPendingTx(txID ids.ID) (*atomic.Tx, bool)
- func (m *Mempool) GetTx(txID ids.ID) (*atomic.Tx, bool, bool)
- func (m *Mempool) Has(txID ids.ID) bool
- func (m *Mempool) IssueCurrentTxs()
- func (m *Mempool) Iterate(f func(tx *atomic.Tx) bool)
- func (m *Mempool) Len() int
- func (m *Mempool) NextTx() (*atomic.Tx, bool)
- func (m *Mempool) RemoveTx(tx *atomic.Tx)
- func (m *Mempool) SubscribePendingTxs() <-chan struct{}
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Mempool ¶
type Mempool struct {
// contains filtered or unexported fields
}
Mempool is a simple mempool for atomic transactions
func NewMempool ¶
func NewMempool(ctx *snow.Context, registerer prometheus.Registerer, maxSize int, verify func(tx *atomic.Tx) error) (*Mempool, error)
NewMempool returns a Mempool with [maxSize]
func (*Mempool) AddRemoteTx ¶
AddRemoteTx attempts to add [tx] to the mempool and returns an error if it could not be added to the mempool.
func (*Mempool) CancelCurrentTx ¶
CancelCurrentTx marks the attempt to issue [txID] as being aborted. This should be called after NextTx returns [txID] and the transaction [txID] cannot be included in the block, but should not be discarded. For example, CancelCurrentTx should be called if including the transaction will put the block above the atomic tx gas limit.
func (*Mempool) CancelCurrentTxs ¶
func (m *Mempool) CancelCurrentTxs()
[CancelCurrentTxs] marks the attempt to issue [currentTxs] as being aborted. If this is called after a buildBlock error caused by the atomic transaction, then DiscardCurrentTx should have been called such that this call will have no effect and should not re-issue the invalid tx.
func (*Mempool) DiscardCurrentTx ¶
DiscardCurrentTx marks a [tx] in the [currentTxs] map as invalid and aborts the attempt to issue it since it failed verification.
func (*Mempool) DiscardCurrentTxs ¶
func (m *Mempool) DiscardCurrentTxs()
DiscardCurrentTxs marks all txs in [currentTxs] as discarded.
func (*Mempool) ForceAddTx ¶
ForceAddTx forcibly adds a *atomic.Tx to the mempool and bypasses all verification.
func (*Mempool) GetPendingTx ¶
GetPendingTx returns the transaction [txID] and true if it is currently in the [txHeap] waiting to be issued into a block. Returns nil, false otherwise.
func (*Mempool) GetTx ¶
GetTx returns the transaction [txID] if it was issued by this node and returns whether it was dropped and whether it exists.
func (*Mempool) IssueCurrentTxs ¶
func (m *Mempool) IssueCurrentTxs()
IssueCurrentTx marks [currentTx] as issued if there is one
func (*Mempool) RemoveTx ¶
RemoveTx removes [txID] from the mempool completely. Evicts [tx] from the discarded cache if present.
func (*Mempool) SubscribePendingTxs ¶
func (m *Mempool) SubscribePendingTxs() <-chan struct{}
SubscribePendingTxs implements the BuilderMempool interface and returns a channel that signals when there is at least one pending transaction in the mempool