Documentation ¶
Index ¶
- func SerializeTxPool(pool *TxPool) []byte
- type TxPool
- func (mp *TxPool) Count() int
- func (mp *TxPool) GetTransaction(hash string) (*chain.Transaction, bool)
- func (mp *TxPool) HaveTransaction(hash string) bool
- func (mp *TxPool) IsOrphanInPool(hash string) bool
- func (mp *TxPool) IsTransactionInPool(hash string) bool
- func (mp *TxPool) MaybeAcceptTransaction(tx *chain.Transaction) ([]*hashx.Hash, error)
- func (mp *TxPool) ProcessTransaction(tx *chain.Transaction, allowOrphan bool) error
- func (mp *TxPool) RemoveOrphan(tx *chain.Transaction)
- func (mp *TxPool) RemoveTransaction(tx *chain.Transaction)
- func (mp *TxPool) TxDescs() []*chain.Transaction
- func (mp *TxPool) TxHashes() [][]byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SerializeTxPool ¶
SerializeTxPool serializes a txpool for []byte
Types ¶
type TxPool ¶
type TxPool struct {
// contains filtered or unexported fields
}
func DeserializeTxPool ¶
DeserializeTxPool deserializes a txpool
func New ¶
func New(bc *chain.Blockchain) *TxPool
New returns a new memory pool for validating and storing standalone transactions until they are mined into a block.
func (*TxPool) Count ¶
Count returns the number of transactions in the main pool. It does not include the orphan pool.
This function is safe for concurrent access.
func (*TxPool) GetTransaction ¶
func (mp *TxPool) GetTransaction(hash string) (*chain.Transaction, bool)
GetTransaction get transaction info from txpool
func (*TxPool) HaveTransaction ¶
HaveTransaction returns whether or not the passed transaction already exists in the main pool or in the orphan pool.
func (*TxPool) IsOrphanInPool ¶
IsOrphanInPool returns whether or not the passed transaction already exists in the orphan pool.
This function is safe for concurrent access.
func (*TxPool) IsTransactionInPool ¶
IsTransactionInPool returns whether or not the passed transaction already exists in the main pool.
This function is safe for concurrent access.
func (*TxPool) MaybeAcceptTransaction ¶
MaybeAcceptTransaction is for handling insertion of new transactions into a mempool.
func (*TxPool) ProcessTransaction ¶
func (mp *TxPool) ProcessTransaction(tx *chain.Transaction, allowOrphan bool) error
ProcessTransaction is the main workhorse for handling insertion of new transactions into the mempool.
func (*TxPool) RemoveOrphan ¶
func (mp *TxPool) RemoveOrphan(tx *chain.Transaction)
RemoveOrphan removes the passed orphan transaction from the orphan pool and previous orphan index.
This function is safe for concurrent access.
func (*TxPool) RemoveTransaction ¶
func (mp *TxPool) RemoveTransaction(tx *chain.Transaction)
RemoveTransaction removes the passed transaction from the mempool.
func (*TxPool) TxDescs ¶
func (mp *TxPool) TxDescs() []*chain.Transaction
TxDescs returns a slice of descriptors for all the transactions in the pool. The descriptors are to be treated as read only.
This function is safe for concurrent access.