Documentation ¶
Index ¶
- Constants
- Variables
- type TransactionPool
- func (tp *TransactionPool) AcceptTransaction(t types.Transaction) (err error)
- func (tp *TransactionPool) IsStandardTransaction(t types.Transaction) (err error)
- func (tp *TransactionPool) PurgeTransactionPool()
- func (tp *TransactionPool) ReceiveConsensusSetUpdate(cc modules.ConsensusChange)
- func (tp *TransactionPool) RelayTransaction(conn modules.PeerConn) error
- func (tp *TransactionPool) TransactionPoolNotify() <-chan struct{}
- func (tp *TransactionPool) TransactionPoolSubscribe(subscriber modules.TransactionPoolSubscriber)
- func (tp *TransactionPool) TransactionSet() []types.Transaction
Constants ¶
const ( PrefixNonSia = "NonSia" TransactionSizeLimit = 16 * 1024 )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type TransactionPool ¶
type TransactionPool struct {
// contains filtered or unexported fields
}
The transaction pool keeps an unconfirmed set of transactions along with the contracts and outputs that have been created by unconfirmed transactions. Incoming transactions are allowed to use objects in the unconfirmed consensus set. Doing so will consume them, preventing other transactions from using them.
func New ¶
func New(cs modules.ConsensusSet, g modules.Gateway) (tp *TransactionPool, err error)
New creates a transaction pool that is ready to receive transactions.
func (*TransactionPool) AcceptTransaction ¶
func (tp *TransactionPool) AcceptTransaction(t types.Transaction) (err 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) IsStandardTransaction ¶
func (tp *TransactionPool) IsStandardTransaction(t types.Transaction) (err error)
IsStandardTransaction enforces extra rules such as a transaction size limit. These rules can be altered without disrupting consensus.
func (*TransactionPool) PurgeTransactionPool ¶ added in v0.3.1
func (tp *TransactionPool) PurgeTransactionPool()
PurgeTransactionPool deletes all transactions from the transaction pool. It's a failsafe for when the transaction pool is producing invalid transaction sets.
func (*TransactionPool) ReceiveConsensusSetUpdate ¶ added in v0.3.1
func (tp *TransactionPool) ReceiveConsensusSetUpdate(cc modules.ConsensusChange)
ReceiveConsensusSetUpdate gets called to inform the transaction pool of changes to the consensus set.
func (*TransactionPool) RelayTransaction ¶ added in v0.3.1
func (tp *TransactionPool) RelayTransaction(conn modules.PeerConn) error
RelayTransaction is an RPC that accepts a transaction from a peer. If the accept is successful, the transaction will be relayed to the Gateway's other peers.
func (*TransactionPool) TransactionPoolNotify ¶ added in v0.3.1
func (tp *TransactionPool) TransactionPoolNotify() <-chan struct{}
TransactionPoolNotify adds a subscriber to the list who will be notified any time that there is a change to the transaction pool (new transaction or block), but that subscriber will not be told any details about the change.
func (*TransactionPool) TransactionPoolSubscribe ¶ added in v0.3.1
func (tp *TransactionPool) TransactionPoolSubscribe(subscriber modules.TransactionPoolSubscriber)
TransactionPoolSubscribe adds a subscriber to the transaction pool that will be given a full list of changes via ReceiveTransactionPoolUpdate any time that there is a change.
func (*TransactionPool) TransactionSet ¶
func (tp *TransactionPool) TransactionSet() []types.Transaction
TransactionSet returns the set of unconfirmed transactions in the order they are required to appear in a block. This function will not limit the volume of transactions to fit in a single block.