Documentation ¶
Index ¶
- Variables
- type BlockChain
- type TxByNonce
- type TxPool
- func (pool *TxPool) AbstractTxsCaching(txs []model.AbstractTransaction)
- func (pool *TxPool) AddLocal(tx model.AbstractTransaction) error
- func (pool *TxPool) AddLocals(txs []model.AbstractTransaction) []error
- func (pool *TxPool) AddRemote(tx model.AbstractTransaction) error
- func (pool *TxPool) AddRemotes(txs []model.AbstractTransaction) []error
- func (pool *TxPool) ConvertPoolToMap() map[common.Hash]model.AbstractTransaction
- func (pool *TxPool) Get(hash common.Hash) model.AbstractTransaction
- func (pool *TxPool) GetTxsEstimator(broadcastBloom *iblt.Bloom) *iblt.HybridEstimator
- func (pool *TxPool) Pending() (map[common.Address][]model.AbstractTransaction, error)
- func (pool *TxPool) Queueing() (map[common.Address][]model.AbstractTransaction, error)
- func (pool *TxPool) RemoveTxs(newBlock model.AbstractBlock)
- func (pool *TxPool) RemoveTxsBatch(txIds []common.Hash)
- func (pool *TxPool) Reset(oldHead, newHead *model.Header)
- func (pool *TxPool) Start() error
- func (pool *TxPool) Stats() (int, int)
- func (pool *TxPool) Status(hashes []common.Hash) []TxStatus
- func (pool *TxPool) Stop()
- func (pool *TxPool) TxsCaching(txs []*model.Transaction)
- type TxPoolConfig
- type TxStatus
Constants ¶
This section is empty.
Variables ¶
var DefaultTxPoolConfig = TxPoolConfig{ NoLocals: true, Journal: "transaction.rlp", Rejournal: time.Hour, FeeBump: 1, AccountSlots: 1024, GlobalSlots: 1024 * 20, AccountQueue: 1024 * 100, GlobalQueue: 1024 * 100, Lifetime: 3 * time.Hour, }
Functions ¶
This section is empty.
Types ¶
type BlockChain ¶
type BlockChain interface { CurrentBlock() model.AbstractBlock GetBlockByNumber(number uint64) model.AbstractBlock StateAtByStateRoot(root common.Hash) (*state_processor.AccountStateDB, error) }
type TxByNonce ¶
type TxByNonce []model.AbstractTransaction
type TxPool ¶
type TxPool struct {
// contains filtered or unexported fields
}
func NewTxPool ¶
func NewTxPool(config TxPoolConfig, chainConfig chain_config.ChainConfig, chain BlockChain) *TxPool
func (*TxPool) AbstractTxsCaching ¶
func (pool *TxPool) AbstractTxsCaching(txs []model.AbstractTransaction)
func (*TxPool) AddLocal ¶
func (pool *TxPool) AddLocal(tx model.AbstractTransaction) error
AddLocal enqueues a single transaction into the pool if it is valid, marking the sender as a local one in the mean time, ensuring it goes around the local pricing constraints.
func (*TxPool) AddLocals ¶
func (pool *TxPool) AddLocals(txs []model.AbstractTransaction) []error
AddLocals enqueues a batch of transactions into the pool if they are valid, marking the senders as a local ones in the mean time, ensuring they go around the local pricing constraints.
func (*TxPool) AddRemote ¶
func (pool *TxPool) AddRemote(tx model.AbstractTransaction) error
AddRemote enqueues a single transaction into the pool if it is valid. If the sender is not among the locally tracked ones, full pricing constraints will apply.
func (*TxPool) AddRemotes ¶
func (pool *TxPool) AddRemotes(txs []model.AbstractTransaction) []error
AddRemotes enqueues a batch of transactions into the pool if they are valid. If the senders are not among the locally tracked ones, full pricing constraints will apply.
func (*TxPool) ConvertPoolToMap ¶
func (pool *TxPool) ConvertPoolToMap() map[common.Hash]model.AbstractTransaction
func (*TxPool) Get ¶
func (pool *TxPool) Get(hash common.Hash) model.AbstractTransaction
Get returns a transaction if it is contained in the pool and nil otherwise.
func (*TxPool) GetTxsEstimator ¶
func (pool *TxPool) GetTxsEstimator(broadcastBloom *iblt.Bloom) *iblt.HybridEstimator
Create local tx pool hybrid estimator
func (*TxPool) Pending ¶
Pending retrieves all currently processable transactions, groupped by origin account and sorted by nonce. The returned transaction set is a copy and can be freely modified by calling code.
func (*TxPool) RemoveTxs ¶
func (pool *TxPool) RemoveTxs(newBlock model.AbstractBlock)
func (*TxPool) RemoveTxsBatch ¶
func (*TxPool) Status ¶
Status returns the status (unknown/pending/queued) of a batch of transactions identified by their hashes.
func (*TxPool) TxsCaching ¶
func (pool *TxPool) TxsCaching(txs []*model.Transaction)
type TxPoolConfig ¶
type TxPoolConfig struct { NoLocals bool // Whether local transaction handling should be disabled Journal string // Journal of local transactions to survive node restarts Rejournal time.Duration // Time interval to regenerate the local transaction journal MinFee *big.Int // Minimum fee to enforce for acceptance into the pool FeeBump uint64 // Minimum fee bump percentage to replace an already existing transaction (nonce) AccountSlots uint64 // Number of executable transaction slots guaranteed per account GlobalSlots uint64 // Maximum number of executable transaction slots for all accounts AccountQueue uint64 // Maximum number of non-executable transaction slots permitted per account GlobalQueue uint64 // Maximum number of non-executable transaction slots for all accounts Lifetime time.Duration // Maximum amount of time non-executable transaction are queued }
TODO:cannot package multiple election transaction in one round TxPoolConfig are the configuration parameters of the transaction pool.