Documentation ¶
Index ¶
- Constants
- type Mempool
- func (mp *Mempool) Add(tx types.BaseTx) (bool, error)
- func (mp *Mempool) CacheSize() int
- func (mp *Mempool) CheckTx(tx tmtypes.Tx, callback func(*abci.Response), txInfo mempool.TxInfo) error
- func (mp *Mempool) CloseWAL()
- func (mp *Mempool) EnableTxsAvailable()
- func (mp *Mempool) Flush()
- func (mp *Mempool) FlushAppConn() error
- func (mp *Mempool) InitWAL() error
- func (mp *Mempool) Lock()
- func (mp *Mempool) ReapMaxBytesMaxGas(maxBytes, maxGas int64) tmtypes.Txs
- func (mp *Mempool) ReapMaxTxs(max int) tmtypes.Txs
- func (mp *Mempool) SetProxyApp(proxyApp proxy.AppConnMempool)
- func (mp *Mempool) Size() int
- func (mp *Mempool) TxsAvailable() <-chan struct{}
- func (mp *Mempool) TxsBytes() int64
- func (mp *Mempool) Unlock()
- func (mp *Mempool) Update(blockHeight int64, txs tmtypes.Txs, responses []*abci.ResponseDeliverTx, ...) error
- type Option
- type Reactor
- func (r *Reactor) AddPeer(peer p2p.Peer)
- func (r *Reactor) AddTx(tx types.BaseTx) (hash util.HexBytes, err error)
- func (r *Reactor) GetChannels() []*p2p.ChannelDescriptor
- func (r *Reactor) GetPoolSize() *core.PoolSizeInfo
- func (r *Reactor) GetTop(n int) []types.BaseTx
- func (r *Reactor) GetTx(hash string) types.BaseTx
- func (r *Reactor) OnStart() error
- func (r *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte)
- func (r *Reactor) RemovePeer(peer p2p.Peer, reason interface{})
Constants ¶
const (
Channel = byte(0x30)
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mempool ¶
type Mempool struct {
// contains filtered or unexported fields
}
Mempool implements mempool.Mempool
func NewMempool ¶
NewMempool creates an instance of Mempool
func (*Mempool) CheckTx ¶
func (mp *Mempool) CheckTx(tx tmtypes.Tx, callback func(*abci.Response), txInfo mempool.TxInfo) error
CheckTx executes a new transaction against the application to determine its validity and whether it should be added to the mempool.
func (*Mempool) CloseWAL ¶
func (mp *Mempool) CloseWAL()
CloseWAL closes and discards the underlying WAL file. Any further writes will not be relayed to disk.
func (*Mempool) EnableTxsAvailable ¶
func (mp *Mempool) EnableTxsAvailable()
EnableTxsAvailable initializes the TxsAvailable channel, ensuring it will trigger once every height when transactions are available.
func (*Mempool) Flush ¶
func (mp *Mempool) Flush()
Flush removes all transactions from the mempool and cache
func (*Mempool) FlushAppConn ¶
FlushAppConn flushes the mempool connection to ensure async reqResCb calls are done. E.g. from CheckTx.
func (*Mempool) Lock ¶
func (mp *Mempool) Lock()
Lock locks the mempool. The consensus must be able to hold lock to safely update.
func (*Mempool) ReapMaxBytesMaxGas ¶
ReapMaxBytesMaxGas reaps transactions from the mempool up to maxBytes bytes total. If both maxBytes are negative, there is no cap on the size of all returned transactions. NOTE: maxGas is ignored since this mempool does not apply the concept of gas
func (*Mempool) ReapMaxTxs ¶
ReapMaxTxs reaps up to max transactions from the mempool. If max is negative, there is no cap on the size of all returned transactions (~ all available transactions).
func (*Mempool) SetProxyApp ¶
func (mp *Mempool) SetProxyApp(proxyApp proxy.AppConnMempool)
SetProxyApp sets the proxy app connection for accessing ABCI app operations required by the mempool
func (*Mempool) TxsAvailable ¶
func (mp *Mempool) TxsAvailable() <-chan struct{}
TxsAvailable returns a channel which fires once for every height, and only when transactions are available in the mempool. NOTE: the returned channel may be nil if EnableTxsAvailable was not called.
func (*Mempool) Update ¶
func (mp *Mempool) Update( blockHeight int64, txs tmtypes.Txs, responses []*abci.ResponseDeliverTx, _ mempool.PreCheckFunc, _ mempool.PostCheckFunc, ) error
Update informs the mempool that the given txs were committed and can be discarded. NOTE: this should be called *after* block is committed by consensus. NOTE: unsafe; Lock/Unlock must be managed by caller
type Reactor ¶
type Reactor struct { p2p.BaseReactor // contains filtered or unexported fields }
Reactor handles mempool tx broadcasting amongst peers. It maintains a map from peer ID to counter, to prevent gossiping txs to the peers you received it from.
func NewReactor ¶
NewReactor returns a new Reactor with the given config and mempool.
func (*Reactor) AddPeer ¶
AddPeer implements Reactor. It starts a broadcast routine ensuring all txs are forwarded to the given peer.
func (*Reactor) GetChannels ¶
func (r *Reactor) GetChannels() []*p2p.ChannelDescriptor
GetChannels implements Reactor. It returns the list of channels for this reactor.
func (*Reactor) GetPoolSize ¶
func (r *Reactor) GetPoolSize() *core.PoolSizeInfo
GetPoolSize returns the size information of the pool
func (*Reactor) GetTop ¶
GetTop returns the top n transactions in the pool. It will return all transactions if n is zero or negative.
func (*Reactor) Receive ¶
Receive implements Reactor. It adds any received transactions to the mempool.
func (*Reactor) RemovePeer ¶
RemovePeer implements Reactor.