Documentation ¶
Index ¶
- Variables
- type TxPool
- func (pool *TxPool) AddLocal(tx *modules.Transaction) error
- func (pool *TxPool) AddRemote(tx *modules.Transaction) error
- func (pool *TxPool) Clear()
- func (pool *TxPool) Content() (map[common.Hash]*txspool.TxPoolTransaction, ...)
- func (pool *TxPool) DeleteTx(hash common.Hash) error
- func (pool *TxPool) DiscardTxs(txs []*modules.Transaction) error
- func (pool *TxPool) GetAddrUtxos(addr common.Address, token *modules.Asset) (map[modules.OutPoint]*modules.Utxo, error)
- func (pool *TxPool) GetSortedTxs() ([]*txspool.TxPoolTransaction, error)
- func (pool *TxPool) GetStxoEntry(outpoint *modules.OutPoint) (*modules.Stxo, error)
- func (pool *TxPool) GetTx(hash common.Hash) (*txspool.TxPoolTransaction, error)
- func (pool *TxPool) GetUnpackedTxsByAddr(addr common.Address) ([]*txspool.TxPoolTransaction, error)
- func (pool *TxPool) GetUtxoEntry(outpoint *modules.OutPoint) (*modules.Utxo, error)
- func (pool *TxPool) GetUtxoFromAll(outpoint *modules.OutPoint) (*modules.Utxo, error)
- func (pool *TxPool) Orphan() ([]*txspool.TxPoolTransaction, error)
- func (pool *TxPool) Packed() (map[common.Hash][]*txspool.TxPoolTransaction, error)
- func (pool *TxPool) ResetPendingTxs(txs []*modules.Transaction) error
- func (pool *TxPool) SetPendingTxs(unitHash common.Hash, num uint64, txs []*modules.Transaction) error
- func (pool *TxPool) Status() (int, int, int)
- func (pool *TxPool) Stop()
- func (pool *TxPool) SubscribeTxPreEvent(ch chan<- modules.TxPreEvent) event.Subscription
- func (pool *TxPool) Unpack() ([]*txspool.TxPoolTransaction, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("txpool: not found") ErrDuplicate = errors.New("txpool: duplicate") ErrDoubleSpend = errors.New("txpool: double spend") ErrNotSupport = errors.New("txpool: not support") )
View Source
var Instance txspool.ITxPool
Functions ¶
This section is empty.
Types ¶
type TxPool ¶
func NewTxPool ¶
func NewTxPool(config txspool.TxPoolConfig, cachedb palletcache.ICache, unit txspool.IDag, enableGasFee bool) *TxPool
NewTxPool creates a new transaction pool to gather, sort and filter inbound transactions from the network.
func NewTxPool4DI ¶
func NewTxPool4DI(config txspool.TxPoolConfig, cachedb palletcache.ICache, dag txspool.IDag, tokenEngine tokenengine.ITokenEngine, txValidator txspool.IValidator) *TxPool
func (*TxPool) AddLocal ¶
func (pool *TxPool) AddLocal(tx *modules.Transaction) error
支持合约Request,普通FullTx,用户合约FullTx的加入,不支持系统合约FullTx
func (*TxPool) Content ¶
func (pool *TxPool) Content() (map[common.Hash]*txspool.TxPoolTransaction, map[common.Hash]*txspool.TxPoolTransaction)
func (*TxPool) DiscardTxs ¶
func (pool *TxPool) DiscardTxs(txs []*modules.Transaction) error
从交易池删除指定的交易
func (*TxPool) GetAddrUtxos ¶
func (*TxPool) GetSortedTxs ¶
func (pool *TxPool) GetSortedTxs() ([]*txspool.TxPoolTransaction, error)
func (*TxPool) GetStxoEntry ¶
func (*TxPool) GetUnpackedTxsByAddr ¶
func (*TxPool) GetUtxoEntry ¶
主要用于Validator,不带锁,从Normal,Request和BasedOnReq三个池获取UTXO,而且禁止双花,如果Pool找不到,就去Dag找
func (*TxPool) GetUtxoFromAll ¶
带锁的对外暴露的查询,只查询Pool的所有新UTXO,不查询DAG
func (*TxPool) Orphan ¶ added in v1.0.9
func (pool *TxPool) Orphan() ([]*txspool.TxPoolTransaction, error)
func (*TxPool) Packed ¶ added in v1.0.9
func (pool *TxPool) GetUnpackedTxs() (map[common.Hash]*txspool.TxPoolTransaction, error) { return pool.normals.GetTxsByStatus(txspool.TxPoolTxStatus_Unpacked) }
func (*TxPool) ResetPendingTxs ¶
func (pool *TxPool) ResetPendingTxs(txs []*modules.Transaction) error
将交易状态改为未打包
func (*TxPool) SetPendingTxs ¶
func (pool *TxPool) SetPendingTxs(unitHash common.Hash, num uint64, txs []*modules.Transaction) error
将交易状态改为已打包
func (*TxPool) SubscribeTxPreEvent ¶
func (pool *TxPool) SubscribeTxPreEvent(ch chan<- modules.TxPreEvent) event.Subscription
SubscribeTxPreEvent registers a subscription of TxPreEvent and starts sending event to the given channel.
Click to show internal directories.
Click to hide internal directories.