transactionpool

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2018 License: MIT Imports: 19 Imported by: 44

Documentation

Index

Constants

View Source
const (

	// TransactionPoolFeeExponentiation defines the polynomial rate of growth
	// required to keep putting transactions into the transaction pool. If the
	// exponentiation is 2, then doubling the size of the transaction pool
	// requires quadrupling the fees of the transactions being added. A higher
	// number makes it harder for the transaction pool to grow beyond its
	// default size during times of congestion.
	TransactionPoolExponentiation = 3

	// TransactionPoolSizeForFee defines how large the transaction pool needs to
	// be before it starts expecting fees to be on the transaction. This initial
	// limit is to help the network grow and provide some wiggle room for
	// wallets that are not yet able to operate via a fee market.
	TransactionPoolSizeForFee = 500e3

	// TransactionPoolSizeTarget defines the target size of the pool when the
	// transactions are paying 1 SC / kb in fees.
	TransactionPoolSizeTarget = 3e6
)

Constants related to the size and ease-of-entry of the transaction pool.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjectID added in v1.0.0

type ObjectID crypto.Hash

ObjectID is the ID of an object such as siacoin output and file contracts, and is used to see if there is are conflicts or overlaps within the transaction pool.

type TransactionPool

type TransactionPool struct {
	// contains filtered or unexported fields
}

The TransactionPool tracks incoming transactions, accepting them or rejecting them based on internal criteria such as fees and unconfirmed double spends.

func New

func New(cs modules.ConsensusSet, g modules.Gateway, persistDir string) (*TransactionPool, error)

New creates a transaction pool that is ready to receive transactions.

func (*TransactionPool) AcceptTransactionSet added in v1.0.0

func (tp *TransactionPool) AcceptTransactionSet(ts []types.Transaction) error

AcceptTransactionSet adds a transaction to the unconfirmed set of transactions. If the transaction is accepted, it will be relayed to connected peers.

TODO: Break into component sets when the set gets accepted.

func (*TransactionPool) Broadcast added in v1.3.0

func (tp *TransactionPool) Broadcast(ts []types.Transaction)

Broadcast broadcasts a transaction set to all of the transaction pool's peers.

func (*TransactionPool) Close added in v1.0.0

func (tp *TransactionPool) Close() error

Close releases any resources held by the transaction pool, stopping all of its worker threads.

func (*TransactionPool) FeeEstimation added in v1.0.0

func (tp *TransactionPool) FeeEstimation() (min, max types.Currency)

FeeEstimation returns an estimation for what fee should be applied to transactions. It returns a minimum and maximum estimated fee per transaction byte.

func (*TransactionPool) ProcessConsensusChange added in v1.0.0

func (tp *TransactionPool) ProcessConsensusChange(cc modules.ConsensusChange)

ProcessConsensusChange gets called to inform the transaction pool of changes to the consensus set.

func (*TransactionPool) PurgeTransactionPool added in v0.3.1

func (tp *TransactionPool) PurgeTransactionPool()

PurgeTransactionPool deletes all transactions from the transaction pool.

func (*TransactionPool) Transaction added in v1.3.0

Transaction returns the transaction with the provided txid, its parents, and a bool indicating if it exists in the transaction pool.

func (*TransactionPool) TransactionConfirmed added in v1.3.2

func (tp *TransactionPool) TransactionConfirmed(id types.TransactionID) (bool, error)

TransactionConfirmed returns true if the transaction has been seen on the blockchain. Note, however, that the block containing the transaction may later be invalidated by a reorg.

func (*TransactionPool) TransactionList added in v1.0.0

func (tp *TransactionPool) TransactionList() []types.Transaction

TransactionList returns a list of all transactions in the transaction pool. The transactions are provided in an order that can acceptably be put into a block.

func (*TransactionPool) TransactionPoolSubscribe added in v0.3.1

func (tp *TransactionPool) TransactionPoolSubscribe(subscriber modules.TransactionPoolSubscriber)

TransactionPoolSubscribe adds a subscriber to the transaction pool. Subscribers will receive the full transaction set every time there is a significant change to the transaction pool.

func (*TransactionPool) TransactionSet

func (tp *TransactionPool) TransactionSet(oid crypto.Hash) []types.Transaction

TransactionSet returns the transaction set the provided object appears in.

func (*TransactionPool) Unsubscribe added in v1.0.0

func (tp *TransactionPool) Unsubscribe(subscriber modules.TransactionPoolSubscriber)

Unsubscribe removes a subscriber from the transaction pool. If the subscriber is not in tp.subscribers, Unsubscribe does nothing. If the subscriber occurs more than once in tp.subscribers, only the earliest occurrence is removed (unsubscription fails).

type TransactionSetID added in v1.0.0

type TransactionSetID crypto.Hash

TransactionSetID is the hash of a transaction set.

Jump to

Keyboard shortcuts

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