Documentation
¶
Index ¶
- Variables
- type Mempool
- type Txs
- func (t *Txs) CancelCurrentTx(txID ids.ID)
- func (t *Txs) CancelCurrentTxs()
- func (t *Txs) DiscardCurrentTx(txID ids.ID)
- func (t *Txs) DiscardCurrentTxs()
- func (t *Txs) GetPendingTx(txID ids.ID) (*atomic.Tx, bool)
- func (t *Txs) GetTx(txID ids.ID) (*atomic.Tx, bool, bool)
- func (t *Txs) Has(txID ids.ID) bool
- func (t *Txs) IssueCurrentTxs()
- func (t *Txs) Iterate(f func(tx *atomic.Tx) bool)
- func (t *Txs) Len() int
- func (t *Txs) NextTx() (*atomic.Tx, bool)
- func (t *Txs) PendingLen() int
- func (t *Txs) RemoveTx(tx *atomic.Tx)
- func (t *Txs) SubscribePendingTxs() <-chan struct{}
Constants ¶
This section is empty.
Variables ¶
var ( ErrAlreadyKnown = errors.New("already known") ErrConflict = errors.New("conflict present") ErrInsufficientFee = errors.New("insufficient fee") ErrMempoolFull = errors.New("mempool full") )
var ErrNoGasUsed = errors.New("no gas used")
Functions ¶
This section is empty.
Types ¶
type Mempool ¶
type Mempool struct {
*Txs
// contains filtered or unexported fields
}
Mempool is a simple mempool for atomic transactions
func NewMempool ¶
func NewMempool( txs *Txs, registerer prometheus.Registerer, verify func(tx *atomic.Tx) error, ) (*Mempool, error)
func (*Mempool) Add ¶
Add attempts to add tx to the mempool as a Remote transaction. It is assumed the quasar context lock is not held.
func (*Mempool) AddLocalTx ¶
AddLocalTx attempts to add tx to the mempool as a Local transaction.
Local transactions are not checked for recent verification failures prior to performing verification. Even if a Local transaction failed verification recently, the mempool will attempt to re-verify it.
func (*Mempool) AddRemoteTx ¶
AddRemoteTx attempts to add tx to the mempool as a Remote transaction.
Remote transactions are checked for recent verification failures prior to performing verification. If a Remote transaction failed verification recently it will not be added to the mempool.
func (*Mempool) ForceAddTx ¶
ForceAddTx forcibly adds a *atomic.Tx to the mempool and bypasses all verification.
type Txs ¶
type Txs struct {
// contains filtered or unexported fields
}
func (*Txs) 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 (*Txs) CancelCurrentTxs ¶
func (t *Txs) 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 (*Txs) DiscardCurrentTx ¶
DiscardCurrentTx marks a [tx] in the [currentTxs] map as invalid and aborts the attempt to issue it since it failed verification.
func (*Txs) DiscardCurrentTxs ¶
func (t *Txs) DiscardCurrentTxs()
DiscardCurrentTxs marks all txs in [currentTxs] as discarded.
func (*Txs) 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 (*Txs) GetTx ¶
GetTx returns the transaction [txID] if it was issued by this node and returns whether it was dropped and whether it exists.
func (*Txs) IssueCurrentTxs ¶
func (t *Txs) IssueCurrentTxs()
IssueCurrentTx marks [currentTx] as issued if there is one
func (*Txs) PendingLen ¶
PendingLen returns the number of pending transactions
func (*Txs) RemoveTx ¶
RemoveTx removes [txID] from the mempool completely. Evicts [tx] from the discarded cache if present.
func (*Txs) SubscribePendingTxs ¶
func (t *Txs) 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