Documentation ¶
Index ¶
- Variables
- type TransactionPool
- func (pool *TransactionPool) AssembleBlock(round basics.Round, deadline time.Time) (assembled *ledger.ValidatedBlock, 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) Test(txgroup []transactions.SignedTxn) error
Constants ¶
This section is empty.
Variables ¶
var ErrStaleBlockAssemblyRequest = fmt.Errorf("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 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) *TransactionPool
MakeTransactionPool makes a transaction pool.
func (*TransactionPool) AssembleBlock ¶
func (pool *TransactionPool) AssembleBlock(round basics.Round, deadline time.Time) (assembled *ledger.ValidatedBlock, err error)
AssembleBlock assembles a block for a given round, trying not to take longer than deadline to finish.
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) 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.