Documentation ¶
Index ¶
- Variables
- func GetDecodedTxs(txDecoder sdk.TxDecoder, txs [][]byte) ([]sdk.Tx, error)
- func GetEncodedTxs(txEncoder sdk.TxEncoder, txs []sdk.Tx) ([][]byte, error)
- func GetTxHash(encoder sdk.TxEncoder, tx sdk.Tx) (string, error)
- func RemoveTxsFromLane(txs []sdk.Tx, mempool sdkmempool.Mempool) error
- func TxHash(txBytes []byte) string
- type CacheTxDecoder
- type TxWithInfo
Constants ¶
This section is empty.
Variables ¶
var DefaultMaxSize uint64 = 500
DefaultMaxSize is the default maximum size of the cache.
Functions ¶
func GetDecodedTxs ¶
GetDecodedTxs returns the decoded transactions from the given bytes.
func GetEncodedTxs ¶
GetEncodedTxs returns the encoded transactions from the given bytes.
func RemoveTxsFromLane ¶
func RemoveTxsFromLane(txs []sdk.Tx, mempool sdkmempool.Mempool) error
RemoveTxsFromLane removes the transactions from the given lane's mempool.
Types ¶
type CacheTxDecoder ¶ added in v2.1.4
type CacheTxDecoder struct {
// contains filtered or unexported fields
}
CacheTxDecoder wraps the sdk.TxDecoder and caches the decoded transactions with an LRU'esque cache. Each transaction is cached using the transaction's hash as the key. The cache is purged when the number of transactions in the cache exceeds the maximum size. The oldest transactions are removed first.
func NewCacheTxDecoder ¶ added in v2.1.4
func NewCacheTxDecoder( decoder sdk.TxDecoder, maxSize uint64, ) (*CacheTxDecoder, error)
NewCacheTxDecoder returns a new CacheTxDecoder with the given cache interval.
func NewDefaultCacheTxDecoder ¶ added in v2.1.4
func NewDefaultCacheTxDecoder( decoder sdk.TxDecoder, ) (*CacheTxDecoder, error)
NewDefaultCacheTxDecoder returns a new CacheTxDecoder.
func (*CacheTxDecoder) Contains ¶ added in v2.1.4
func (ctd *CacheTxDecoder) Contains(txBytes []byte) bool
Contains returns true if the cache contains the transaction with the given hash.
func (*CacheTxDecoder) Len ¶ added in v2.1.4
func (ctd *CacheTxDecoder) Len() int
Len returns the number of transactions in the cache.
func (*CacheTxDecoder) TxDecoder ¶ added in v2.1.4
func (ctd *CacheTxDecoder) TxDecoder() sdk.TxDecoder
Decode decodes the transaction bytes into a sdk.Tx. It caches the decoded transaction using the transaction's hash as the key.
type TxWithInfo ¶
type TxWithInfo struct { // Hash is the hex-encoded hash of the transaction. Hash string // Size is the size of the transaction in bytes. Size int64 // GasLimit is the gas limit of the transaction. GasLimit uint64 // TxBytes is the bytes of the transaction. TxBytes []byte // Priority defines the priority of the transaction. Priority any // Signers defines the signers of a transaction. Signers []signerextraction.SignerData }
TxWithInfo contains the information required for a transaction to be included in a proposal.
func NewTxInfo ¶
func NewTxInfo( hash string, size int64, gasLimit uint64, txBytes []byte, priority any, signers []signerextraction.SignerData, ) TxWithInfo
NewTxInfo returns a new TxInfo instance.
func (TxWithInfo) String ¶
func (t TxWithInfo) String() string
String implements the fmt.Stringer interface.