pools

package
v0.0.0-...-15eb78e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2022 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 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() (*ledgercore.ValidatedBlock, error)
	ResetTxnBytes()
}

BlockEvaluator defines the block evaluator interface exposed by the ledger package.

BlockEvaluator는 ledger 패키지에 의해 노출되는 인터페이스이다(ledger에서 사용한다는건가? ㅇㅇ)

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.

트랜잭션풀은 제안을 위한 검증된 블록을 준비하고 검증된 트랜잭션 그룹을 캐시(임시저장)한다.
트랜잭션풀은 언제나 제안을 위해 선발된 트랜잭션그룹의 큐를 관리한다.
TransactionPool.Remember: 트랜잭션풀은 올바르게 서명되고 잘 만들어진 트랜잭션 그룹을 이 큐에 추가한다.
단, 수수료가 적절히 높고 상태변화가 이미 큐에 들어있는 트랜잭션들과 동일한경우에만(GroupContext의 값. 즉, 합의버전 등이 동일한 경우겠지?).
TransactionPool.AssembleBlock: 주어진 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 *ledgercore.ValidatedBlock, 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.ValidatedBlock, 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 micronovas 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL