Documentation
¶
Index ¶
- Variables
- type BlockEvaluator
- type ErrTxPoolFeeError
- type TransactionPool
- func (pool *TransactionPool) AssembleBlock(round basics.Round, deadline time.Time) (assembled *ledgercore.UnfinishedBlock, err error)
- func (pool *TransactionPool) AssembleDevModeBlock() (assembled *ledgercore.UnfinishedBlock, err error)
- func (pool *TransactionPool) FeePerByte() uint64
- func (pool *TransactionPool) Lookup(txid transactions.Txid) (tx transactions.SignedTxn, txErr string, found bool)
- func (pool *TransactionPool) NumExpired(round basics.Round) int
- func (pool *TransactionPool) OnNewBlock(block bookkeeping.Block, delta ledgercore.StateDelta)
- func (pool *TransactionPool) PendingCount() int
- func (pool *TransactionPool) PendingTxGroups() [][]transactions.SignedTxn
- func (pool *TransactionPool) PendingTxIDs() []transactions.Txid
- func (pool *TransactionPool) Remember(txgroup []transactions.SignedTxn) error
- func (pool *TransactionPool) RememberOne(t transactions.SignedTxn) error
- func (pool *TransactionPool) Reset()
- func (pool *TransactionPool) Shutdown()
- func (pool *TransactionPool) Test(txgroup []transactions.SignedTxn) error
- type VotingAccountSupplier
Constants ¶
This section is empty.
Variables ¶
var ErrNoPendingBlockEvaluator = errors.New("TransactionPool.ingest: no pending block evaluator")
ErrNoPendingBlockEvaluator indicates there is no pending block evaluator to accept a new tx group
var ErrPendingQueueReachedMaxCap = errors.New("TransactionPool.checkPendingQueueSize: transaction pool have reached capacity")
ErrPendingQueueReachedMaxCap indicates the current transaction pool has reached its max capacity
var ErrStaleBlockAssemblyRequest = errors.New("AssembleBlock: requested block assembly specified a round that is older than current transaction pool round")
ErrStaleBlockAssemblyRequest returned by AssembleBlock when requested block number is older than the current transaction pool round i.e. typically it means that we're trying to make a proposal for an older round than what the ledger is currently pointing at.
Functions ¶
This section is empty.
Types ¶
type BlockEvaluator ¶
type BlockEvaluator interface { TestTransactionGroup(txgroup []transactions.SignedTxn) error Round() basics.Round PaySetSize() int TransactionGroup(txads []transactions.SignedTxnWithAD) error Transaction(txn transactions.SignedTxn, ad transactions.ApplyData) error GenerateBlock(addrs []basics.Address) (*ledgercore.UnfinishedBlock, error) ResetTxnBytes() }
BlockEvaluator defines the block evaluator interface exposed by the ledger package.
type ErrTxPoolFeeError ¶
type ErrTxPoolFeeError struct {
// contains filtered or unexported fields
}
ErrTxPoolFeeError is an error type for txpool fee escalation checks
func (*ErrTxPoolFeeError) Error ¶
func (e *ErrTxPoolFeeError) Error() string
type TransactionPool ¶
type TransactionPool struct {
// contains filtered or unexported fields
}
A TransactionPool prepares valid blocks for proposal and caches validated transaction groups.
At all times, a TransactionPool maintains a queue of transaction groups slated for proposal. TransactionPool.Remember adds a properly-signed and well-formed transaction group to this queue only if its fees are sufficiently high and its state changes are consistent with the prior transactions in the queue.
TransactionPool.AssembleBlock constructs a valid block for proposal given a deadline.
func MakeTransactionPool ¶
func MakeTransactionPool(ledger *ledger.Ledger, cfg config.Local, log logging.Logger, vac VotingAccountSupplier) *TransactionPool
MakeTransactionPool makes a transaction pool.
func (*TransactionPool) AssembleBlock ¶
func (pool *TransactionPool) AssembleBlock(round basics.Round, deadline time.Time) (assembled *ledgercore.UnfinishedBlock, err error)
AssembleBlock assembles a block for a given round, trying not to take longer than deadline to finish.
func (*TransactionPool) AssembleDevModeBlock ¶
func (pool *TransactionPool) AssembleDevModeBlock() (assembled *ledgercore.UnfinishedBlock, err error)
AssembleDevModeBlock assemble a new block from the existing transaction pool. The pending evaluator is being
func (*TransactionPool) FeePerByte ¶
func (pool *TransactionPool) FeePerByte() uint64
FeePerByte returns the current minimum microalgos per byte a transaction needs to pay in order to get into the pool.
func (*TransactionPool) Lookup ¶
func (pool *TransactionPool) Lookup(txid transactions.Txid) (tx transactions.SignedTxn, txErr string, found bool)
Lookup returns the error associated with a transaction that used to be in the pool. If no status information is available (e.g., because it was too long ago, or the transaction committed successfully), then found is false. If the transaction is still in the pool, txErr is empty.
func (*TransactionPool) NumExpired ¶
func (pool *TransactionPool) NumExpired(round basics.Round) int
NumExpired returns the number of transactions that expired at the end of a round (only meaningful if cleanup has been called for that round).
func (*TransactionPool) OnNewBlock ¶
func (pool *TransactionPool) OnNewBlock(block bookkeeping.Block, delta ledgercore.StateDelta)
OnNewBlock excises transactions from the pool that are included in the specified Block or if they've expired
func (*TransactionPool) PendingCount ¶
func (pool *TransactionPool) PendingCount() int
PendingCount returns the number of transactions currently pending in the pool.
func (*TransactionPool) PendingTxGroups ¶
func (pool *TransactionPool) PendingTxGroups() [][]transactions.SignedTxn
PendingTxGroups returns a list of transaction groups that should be proposed in the next block, in order.
func (*TransactionPool) PendingTxIDs ¶
func (pool *TransactionPool) PendingTxIDs() []transactions.Txid
PendingTxIDs return the IDs of all pending transactions.
func (*TransactionPool) Remember ¶
func (pool *TransactionPool) Remember(txgroup []transactions.SignedTxn) error
Remember stores the provided transaction group. Precondition: Only Remember() properly-signed and well-formed transactions (i.e., ensure t.WellFormed())
func (*TransactionPool) RememberOne ¶
func (pool *TransactionPool) RememberOne(t transactions.SignedTxn) error
RememberOne stores the provided transaction. Precondition: Only RememberOne() properly-signed and well-formed transactions (i.e., ensure t.WellFormed())
func (*TransactionPool) Reset ¶
func (pool *TransactionPool) Reset()
Reset resets the content of the transaction pool
func (*TransactionPool) Shutdown ¶
func (pool *TransactionPool) Shutdown()
Shutdown stops the transaction pool from accepting new transactions and blocks. It takes the pool.mu lock in order to ensure there is no pending remember or block operations in flight and sets the shutdown flag to true.
func (*TransactionPool) Test ¶
func (pool *TransactionPool) Test(txgroup []transactions.SignedTxn) error
Test performs basic duplicate detection and well-formedness checks on a transaction group without storing the group.