Documentation ¶
Index ¶
- Constants
- Variables
- type ObjectID
- type TransactionPool
- func (tp *TransactionPool) AcceptTransactionSet(ts []types.Transaction) error
- func (tpool *TransactionPool) Alerts() (crit, err, warn []modules.Alert)
- func (tp *TransactionPool) Broadcast(ts []types.Transaction)
- func (tp *TransactionPool) Close() error
- func (tp *TransactionPool) FeeEstimation() (min, max types.Currency)
- func (tp *TransactionPool) ProcessConsensusChange(cc modules.ConsensusChange)
- func (tp *TransactionPool) PurgeTransactionPool()
- func (tp *TransactionPool) Transaction(id types.TransactionID) (types.Transaction, []types.Transaction, bool)
- func (tp *TransactionPool) TransactionConfirmed(id types.TransactionID) (bool, error)
- func (tp *TransactionPool) TransactionList() []types.Transaction
- func (tp *TransactionPool) TransactionPoolSubscribe(subscriber modules.TransactionPoolSubscriber)
- func (tp *TransactionPool) TransactionSet(oid crypto.Hash) []types.Transaction
- func (tp *TransactionPool) Transactions() []types.Transaction
- func (tp *TransactionPool) Unsubscribe(subscriber modules.TransactionPoolSubscriber)
Constants ¶
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 ¶
var ( // ErrTxnSetNotAccepted is the error returned when the dependency // DoNotAcceptTxnSet is used ErrTxnSetNotAccepted = errors.New("transaction set was not accepted") )
var ( // MaxTransactionAge determines the maximum age of a transaction (in block // height) allowed before the transaction is pruned from the transaction // pool. MaxTransactionAge = build.Select(build.Var{ Standard: types.BlockHeight(24), Dev: types.BlockHeight(12), Testing: types.BlockHeight(5), }).(types.BlockHeight) )
Variables related to propagating transactions through the network.
Functions ¶
This section is empty.
Types ¶
type ObjectID ¶ added in v1.0.0
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 NewCustomTPool ¶ added in v1.4.3
func NewCustomTPool(cs modules.ConsensusSet, g modules.Gateway, persistDir string, deps modules.Dependencies) (*TransactionPool, error)
NewCustomTPool creates a transaction pool with custom dependencies.
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.
func (*TransactionPool) Alerts ¶ added in v1.4.2
func (tpool *TransactionPool) Alerts() (crit, err, warn []modules.Alert)
Alerts implements the modules.Alerter interface for the transactionpool.
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
func (tp *TransactionPool) Transaction(id types.TransactionID) (types.Transaction, []types.Transaction, bool)
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) Transactions ¶ added in v1.4.2
func (tp *TransactionPool) Transactions() []types.Transaction
Transactions returns the transactions of the transaction pool
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).