Documentation ¶
Index ¶
- type EWMA
- type FeeTracker
- type TransactionPool
- func (pool *TransactionPool) EvalOk(cvers protocol.ConsensusVersion, txid transactions.Txid) (found bool, err error)
- func (pool *TransactionPool) EvalRemember(cvers protocol.ConsensusVersion, txid transactions.Txid, err error)
- 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 ledger.StateDelta)
- func (pool *TransactionPool) Pending() [][]transactions.SignedTxn
- func (pool *TransactionPool) PendingCount() int
- 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) Test(txgroup []transactions.SignedTxn) error
- func (pool *TransactionPool) Verified(txn transactions.SignedTxn) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EWMA ¶
type EWMA struct {
// contains filtered or unexported fields
}
EWMA represents an exponentially moving average based on the following formula -
EWMA(S_0) = S_0 EWMA(S_n) = \alpha*S_n + (1-\alpha)*S_{n-1}
type FeeTracker ¶
type FeeTracker struct {
// contains filtered or unexported fields
}
FeeTracker keeps track of the fees on the ledger and provides suggested fee
func MakeFeeTracker ¶
func MakeFeeTracker() (*FeeTracker, error)
MakeFeeTracker creates a new Fee Tracker
func (*FeeTracker) EstimateFee ¶
func (ft *FeeTracker) EstimateFee() basics.MicroAlgos
EstimateFee returns the current suggested fee per byte
func (*FeeTracker) ProcessBlock ¶
func (ft *FeeTracker) ProcessBlock(block bookkeeping.Block)
ProcessBlock takes a block and update the current suggested fee
type TransactionPool ¶
type TransactionPool struct {
// contains filtered or unexported fields
}
TransactionPool is a struct maintaining a sanitized pool of transactions that are available for inclusion in a Block. We sanitize it by preventing duplicates and limiting the number of transactions retained for each account
func MakeTransactionPool ¶
func MakeTransactionPool(ledger *ledger.Ledger, cfg config.Local) *TransactionPool
MakeTransactionPool is the constructor, it uses Ledger to ensure that no account has pending transactions that together overspend.
The pool also contains status information for the last transactionPoolStatusSize transactions that were removed from the pool without being committed.
func (*TransactionPool) EvalOk ¶
func (pool *TransactionPool) EvalOk(cvers protocol.ConsensusVersion, txid transactions.Txid) (found bool, err error)
EvalOk for LogicSig Eval of a txn by txid, returns the SignedTxn, error string, and found.
func (*TransactionPool) EvalRemember ¶
func (pool *TransactionPool) EvalRemember(cvers protocol.ConsensusVersion, txid transactions.Txid, err error)
EvalRemember sets an error string from LogicSig Eval for some SignedTxn
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 ledger.StateDelta)
OnNewBlock excises transactions from the pool that are included in the specified Block or if they've expired
func (*TransactionPool) Pending ¶
func (pool *TransactionPool) Pending() [][]transactions.SignedTxn
Pending returns a list of transaction groups that should be proposed in the next block, in order.
func (*TransactionPool) PendingCount ¶
func (pool *TransactionPool) PendingCount() int
PendingCount returns the number of transactions currently pending in the pool.
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) 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.
func (*TransactionPool) Verified ¶
func (pool *TransactionPool) Verified(txn transactions.SignedTxn) bool
Verified returns whether a given SignedTxn is already in the pool, and, since only verified transactions should be added to the pool, whether that transaction is verified (i.e., Verify returned success). This is used as an optimization to avoid re-checking signatures on transactions that we have already verified.