Documentation ¶
Index ¶
- Constants
- Variables
- type ObjectID
- type TransactionPool
- func (tp *TransactionPool) AcceptTransactionSet(ts []types.Transaction) error
- func (tp *TransactionPool) Close() error
- func (tp *TransactionPool) FeeEstimation() (min, max types.Currency)
- func (tp *TransactionPool) IsStandardTransaction(t types.Transaction) error
- func (tp *TransactionPool) IsStandardTransactionSet(ts []types.Transaction) error
- func (tp *TransactionPool) ProcessConsensusChange(cc modules.ConsensusChange)
- func (tp *TransactionPool) PurgeTransactionPool()
- func (tp *TransactionPool) TransactionList() []types.Transaction
- func (tp *TransactionPool) TransactionPoolSubscribe(subscriber modules.TransactionPoolSubscriber)
- func (tp *TransactionPool) Unsubscribe(subscriber modules.TransactionPoolSubscriber)
- type TransactionSetID
Constants ¶
const ( // The TransactionPoolSizeLimit is first checked, and then a transaction // set is added. The current transaction pool does not do any priority // ordering, so the size limit is such that the transaction pool will never // exceed the size of a block. // // TODO: Add a priority structure that will allow the transaction pool to // fill up beyond the size of a single block, without being subject to // manipulation. // // The first ~1/4 of the transaction pool can be filled for free. This is // mostly to preserve compatibility with clients that do not add fees. TransactionPoolSizeLimit = 2e6 - 5e3 - modules.TransactionSetSizeLimit TransactionPoolSizeForFee = 500e3 )
Variables ¶
var ( // TransactionMinFee defines the minimum fee required for a transaction in // order for it to be accepted if there is already more than // TransactionPoolSizeForFee transactions in the transaction pool. TransactionMinFee = types.SiacoinPrecision.Div64(20) )
Functions ¶
This section is empty.
Types ¶
type ObjectID ¶ added in v1.0.0
ObjectIDs are the IDs of objects such as siacoin outputs and file contracts, and are used to see if there are conflicts or overlaps within the transaction pool. A TransactionSetID is the hash of a transaction set.
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
AcceptTransaction adds a transaction to the unconfirmed set of transactions. If the transaction is accepted, it will be relayed to connected peers.
func (*TransactionPool) Close ¶ added in v1.0.0
func (tp *TransactionPool) Close() error
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.
func (*TransactionPool) IsStandardTransaction ¶
func (tp *TransactionPool) IsStandardTransaction(t types.Transaction) error
IsStandardTransaction enforces extra rules such as a transaction size limit. These rules can be altered without disrupting consensus.
func (*TransactionPool) IsStandardTransactionSet ¶ added in v1.0.0
func (tp *TransactionPool) IsStandardTransactionSet(ts []types.Transaction) error
IsStandardTransactionSet checks that all transacitons of a set follow the IsStandard guidelines, and that the set as a whole follows the guidelines as well.
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) 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) 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).