Documentation
¶
Index ¶
- Variables
- type EvmSenderNonceMempool
- func (snm *EvmSenderNonceMempool) CountTx() int
- func (snm *EvmSenderNonceMempool) Insert(_ context.Context, tx sdk.Tx) error
- func (mp *EvmSenderNonceMempool) NextSenderTx(sender string) sdk.Tx
- func (snm *EvmSenderNonceMempool) Remove(tx sdk.Tx) error
- func (snm *EvmSenderNonceMempool) Select(_ context.Context, _ [][]byte) mempool.Iterator
- type EvmSenderNonceOptions
Constants ¶
This section is empty.
Variables ¶
var DefaultMaxTx = 0
Functions ¶
This section is empty.
Types ¶
type EvmSenderNonceMempool ¶
type EvmSenderNonceMempool struct {
// contains filtered or unexported fields
}
EvmSenderNonceMempool is a mempool that prioritizes transactions within a sender by nonce, the lowest first, but selects a random sender on each iteration. Additionality it supports evm custom message handling. The mempool is iterated by:
1) Maintaining a separate list of nonce ordered txs per sender 2) For each select iteration, randomly choose a sender and pick the next nonce ordered tx from their list 3) Repeat 1,2 until the mempool is exhausted
Note that PrepareProposal could choose to stop iteration before reaching the end if maxBytes is reached.
func NewEvmSenderNonceMempool ¶
func NewEvmSenderNonceMempool(opts ...EvmSenderNonceOptions) *EvmSenderNonceMempool
NewEvmSenderNonceMempool creates a new mempool that prioritizes transactions by nonce, the lowest first, picking a random sender on each iteration.
func (*EvmSenderNonceMempool) CountTx ¶
func (snm *EvmSenderNonceMempool) CountTx() int
CountTx returns the total count of txs in the mempool.
func (*EvmSenderNonceMempool) Insert ¶
Insert adds a tx to the mempool. It returns an error if the tx does not have at least one signer. Note, priority is ignored.
func (*EvmSenderNonceMempool) NextSenderTx ¶
func (mp *EvmSenderNonceMempool) NextSenderTx(sender string) sdk.Tx
NextSenderTx returns the next transaction for a given sender by nonce order, i.e. the next valid transaction for the sender. If no such transaction exists, nil will be returned.
func (*EvmSenderNonceMempool) Remove ¶
func (snm *EvmSenderNonceMempool) Remove(tx sdk.Tx) error
Remove removes a tx from the mempool. It returns an error if the tx does not have at least one signer or the tx was not found in the pool.
type EvmSenderNonceOptions ¶
type EvmSenderNonceOptions func(mp *EvmSenderNonceMempool)
func SenderNonceMaxTxOpt ¶
func SenderNonceMaxTxOpt(maxTx int) EvmSenderNonceOptions
SenderNonceMaxTxOpt Option To set limit of max tx when calling the constructor NewEvmSenderNonceMempool.
Example:
NewEvmSenderNonceMempool(SenderNonceMaxTxOpt(100))
func SenderNonceSeedOpt ¶
func SenderNonceSeedOpt(seed int64) EvmSenderNonceOptions
SenderNonceSeedOpt Option To add a Seed for random type when calling the constructor NewEvmSenderNonceMempool.
Example:
random_seed := int64(1000) NewEvmSenderNonceMempool(SenderNonceSeedTxOpt(random_seed))