Documentation
¶
Index ¶
- Variables
- func IsBadTx(err error) bool
- func IsTxRejected(err error) bool
- type MempoolAdapter
- func (m *MempoolAdapter) CheckTx(tx cmttypes.Tx, peerID p2p.ID) (*abcicli.ReqRes, error)
- func (m *MempoolAdapter) CloseWAL()
- func (m *MempoolAdapter) Contains(txKey cmttypes.TxKey) bool
- func (m *MempoolAdapter) EnableTxsAvailable()
- func (m *MempoolAdapter) Flush()
- func (m *MempoolAdapter) FlushAppConn() error
- func (m *MempoolAdapter) GetSenders(txKey cmttypes.TxKey) ([]p2p.ID, error)
- func (m *MempoolAdapter) GetTxByHash(hash []byte) cmttypes.Tx
- func (m *MempoolAdapter) GetTxPool() *TxPool
- func (m *MempoolAdapter) InMempool(txKey cmttypes.TxKey) bool
- func (m *MempoolAdapter) InitWAL() error
- func (m *MempoolAdapter) Lock()
- func (m *MempoolAdapter) PreUpdate()
- func (m *MempoolAdapter) ReapMaxBytesMaxGas(maxBytes, maxGas int64) cmttypes.Txs
- func (m *MempoolAdapter) ReapMaxTxs(max int) cmttypes.Txs
- func (m *MempoolAdapter) RemoveTxByKey(txKey cmttypes.TxKey) error
- func (m *MempoolAdapter) Size() int
- func (m *MempoolAdapter) SizeBytes() int64
- func (m *MempoolAdapter) TxsAvailable() <-chan struct{}
- func (m *MempoolAdapter) TxsBytes() int64
- func (m *MempoolAdapter) TxsWaitChan() <-chan struct{}
- func (m *MempoolAdapter) Unlock()
- func (m *MempoolAdapter) Update(blockHeight int64, blockTxs cmttypes.Txs, txResults []*abci.ExecTxResult, ...) error
- type MempoolConfig
- type Options
- type TxEvent
- type TxPool
- func (p *TxPool) Add(newTx cmttypes.Tx) error
- func (p *TxPool) All() []*txObject
- func (p *TxPool) Close()
- func (p *TxPool) Dump() types.Transactions
- func (p *TxPool) Executables() types.Transactions
- func (p *TxPool) Fill(txs types.Transactions, executed func(txID []byte) bool)
- func (p *TxPool) Get(id []byte) cmttypes.Tx
- func (p *TxPool) GetNewTxFeed() chan []byte
- func (p *TxPool) GetTxObj(id []byte) *txObject
- func (p *TxPool) Len() int
- func (p *TxPool) LenBytes() int64
- func (p *TxPool) ReapMaxTxs(limit int) types.Transactions
- func (p *TxPool) Remove(id []byte) bool
- func (p *TxPool) StrictlyAdd(newTx cmttypes.Tx) error
- func (p *TxPool) SubscribeTxEvent(ch chan *TxEvent) event.Subscription
Constants ¶
This section is empty.
Variables ¶
var DefaultTxPoolOptions = Options{ Limit: 200000, LimitPerAccount: 1024, MaxLifetime: 20 * time.Minute, }
Functions ¶
func IsTxRejected ¶
IsTxRejected returns whether the given error indicates tx is rejected.
Types ¶
type MempoolAdapter ¶ added in v0.3.16
type MempoolAdapter struct {
// contains filtered or unexported fields
}
MempoolAdapter adapts Supernova's TxPool to implement CometBFT's mempool interface This allows Cosmos SDK modules to interact with the txpool through the standard mempool interface
func NewMempoolAdapter ¶ added in v0.3.16
func NewMempoolAdapter(txPool *TxPool, proxyApp cmtproxy.AppConnMempool, config *MempoolConfig) *MempoolAdapter
NewMempoolAdapter creates a new mempool adapter
func (*MempoolAdapter) CheckTx ¶ added in v0.3.16
CheckTx checks if a transaction is valid and adds it to the mempool
func (*MempoolAdapter) CloseWAL ¶ added in v0.3.16
func (m *MempoolAdapter) CloseWAL()
CloseWAL closes the write-ahead log
func (*MempoolAdapter) Contains ¶ added in v0.3.25
func (m *MempoolAdapter) Contains(txKey cmttypes.TxKey) bool
Contains checks if a transaction with the given key exists in the mempool
func (*MempoolAdapter) EnableTxsAvailable ¶ added in v0.3.16
func (m *MempoolAdapter) EnableTxsAvailable()
EnableTxsAvailable enables the TxsAvailable channel
func (*MempoolAdapter) Flush ¶ added in v0.3.16
func (m *MempoolAdapter) Flush()
Flush removes all transactions from the mempool
func (*MempoolAdapter) FlushAppConn ¶ added in v0.3.16
func (m *MempoolAdapter) FlushAppConn() error
FlushAppConn flushes the application connection
func (*MempoolAdapter) GetSenders ¶ added in v0.3.25
GetSenders returns a slice of unique p2p.IDs for the given transaction key. This is a stub implementation; update as needed to extract sender IDs from your transactions.
func (*MempoolAdapter) GetTxByHash ¶ added in v0.3.25
func (m *MempoolAdapter) GetTxByHash(hash []byte) cmttypes.Tx
GetTxByHash returns the transaction corresponding to the given hash, or nil if not found.
func (*MempoolAdapter) GetTxPool ¶ added in v0.3.16
func (m *MempoolAdapter) GetTxPool() *TxPool
GetTxPool returns the underlying TxPool for direct access if needed
func (*MempoolAdapter) InMempool ¶ added in v0.3.16
func (m *MempoolAdapter) InMempool(txKey cmttypes.TxKey) bool
InMempool checks if a transaction is in the mempool
func (*MempoolAdapter) InitWAL ¶ added in v0.3.16
func (m *MempoolAdapter) InitWAL() error
InitWAL initializes the write-ahead log
func (*MempoolAdapter) Lock ¶ added in v0.3.16
func (m *MempoolAdapter) Lock()
Lock locks the mempool
func (*MempoolAdapter) PreUpdate ¶ added in v0.3.16
func (m *MempoolAdapter) PreUpdate()
PreUpdate is called before a block is committed
func (*MempoolAdapter) ReapMaxBytesMaxGas ¶ added in v0.3.16
func (m *MempoolAdapter) ReapMaxBytesMaxGas(maxBytes, maxGas int64) cmttypes.Txs
ReapMaxBytesMaxGas reaps transactions from the mempool up to maxBytes and maxGas
func (*MempoolAdapter) ReapMaxTxs ¶ added in v0.3.16
func (m *MempoolAdapter) ReapMaxTxs(max int) cmttypes.Txs
ReapMaxTxs reaps up to max transactions from the mempool
func (*MempoolAdapter) RemoveTxByKey ¶ added in v0.3.16
func (m *MempoolAdapter) RemoveTxByKey(txKey cmttypes.TxKey) error
RemoveTxByKey removes a transaction from the mempool by its key
func (*MempoolAdapter) Size ¶ added in v0.3.16
func (m *MempoolAdapter) Size() int
Size returns the number of transactions in the mempool
func (*MempoolAdapter) SizeBytes ¶ added in v0.3.16
func (m *MempoolAdapter) SizeBytes() int64
SizeBytes returns the total size of all transactions in the mempool
func (*MempoolAdapter) TxsAvailable ¶ added in v0.3.16
func (m *MempoolAdapter) TxsAvailable() <-chan struct{}
TxsAvailable returns a channel that fires when transactions are available
func (*MempoolAdapter) TxsBytes ¶ added in v0.3.16
func (m *MempoolAdapter) TxsBytes() int64
TxsBytes returns the total size of all transactions in bytes
func (*MempoolAdapter) TxsWaitChan ¶ added in v0.3.16
func (m *MempoolAdapter) TxsWaitChan() <-chan struct{}
TxsWaitChan returns a channel that fires when transactions are available
func (*MempoolAdapter) Unlock ¶ added in v0.3.16
func (m *MempoolAdapter) Unlock()
Unlock unlocks the mempool
func (*MempoolAdapter) Update ¶ added in v0.3.16
func (m *MempoolAdapter) Update( blockHeight int64, blockTxs cmttypes.Txs, txResults []*abci.ExecTxResult, preCheck mempl.PreCheckFunc, postCheck mempl.PostCheckFunc, ) error
Update updates the mempool after a block has been committed
type MempoolConfig ¶ added in v0.3.16
type TxPool ¶
type TxPool struct {
// contains filtered or unexported fields
}
TxPool maintains unprocessed transactions.
func (*TxPool) Add ¶
Add add new tx into pool. It's not assumed as an error if the tx to be added is already in the pool,
func (*TxPool) Executables ¶
func (p *TxPool) Executables() types.Transactions
Executables returns executable txs.
func (*TxPool) Fill ¶
func (p *TxPool) Fill(txs types.Transactions, executed func(txID []byte) bool)
Fill fills txs into pool.
func (*TxPool) GetNewTxFeed ¶
func (*TxPool) ReapMaxTxs ¶ added in v0.3.13
func (p *TxPool) ReapMaxTxs(limit int) types.Transactions
func (*TxPool) StrictlyAdd ¶
StrictlyAdd add new tx into pool. A rejection error will be returned, if tx is not executable at this time.
func (*TxPool) SubscribeTxEvent ¶
func (p *TxPool) SubscribeTxEvent(ch chan *TxEvent) event.Subscription
SubscribeTxEvent receivers will receive a tx