Documentation ¶
Index ¶
- Variables
- type DeferServer
- type FRet
- type Iterator
- type SortedTxMap
- type TxPImpl
- func (pool *TxPImpl) AddDefertx(txHash []byte) error
- func (pool *TxPImpl) AddLinkedNode(linkedNode *blockcache.BlockCacheNode) error
- func (pool *TxPImpl) AddTx(t *tx.Tx) error
- func (pool *TxPImpl) DelTx(hash []byte) error
- func (pool *TxPImpl) ExistTxs(hash []byte, chainBlock *block.Block) FRet
- func (pool *TxPImpl) GetFromChain(hash []byte) (*tx.Tx, *tx.TxReceipt, error)
- func (pool *TxPImpl) GetFromPending(hash []byte) (*tx.Tx, error)
- func (pool *TxPImpl) PendingTx() (*SortedTxMap, *blockcache.BlockCacheNode)
- func (pool *TxPImpl) Start() error
- func (pool *TxPImpl) Stop()
- type TxPool
Constants ¶
This section is empty.
Variables ¶
var ( ErrDupPendingTx = errors.New("tx exists in pending") ErrDupChainTx = errors.New("tx exists in chain") ErrCacheFull = errors.New("txpool is full") ErrTxNotFound = errors.New("tx not found") )
Values.
Functions ¶
This section is empty.
Types ¶
type DeferServer ¶ added in v1.1.0
type DeferServer struct {
// contains filtered or unexported fields
}
DeferServer manages defer transaction index and sends them to txpool on time.
func NewDeferServer ¶ added in v1.1.0
func NewDeferServer(txpool *TxPImpl) (*DeferServer, error)
NewDeferServer returns a new DeferServer instance.
func (*DeferServer) DelDeferTx ¶ added in v1.1.0
func (d *DeferServer) DelDeferTx(deferTx *tx.Tx) error
DelDeferTx deletes a tx in defer server.
func (*DeferServer) DelDeferTxByHash ¶
func (d *DeferServer) DelDeferTxByHash(txHash []byte)
DelDeferTxByHash deletes a tx in defer server by referredTx hash.
func (*DeferServer) DumpDeferTx ¶ added in v1.1.0
func (d *DeferServer) DumpDeferTx() []*tx.Tx
DumpDeferTx dumps all defer transactions for debug.
func (*DeferServer) Start ¶ added in v1.1.0
func (d *DeferServer) Start() error
Start starts the defer server.
func (*DeferServer) Stop ¶ added in v1.1.0
func (d *DeferServer) Stop()
Stop stops the defer server.
func (*DeferServer) StoreDeferTx ¶ added in v1.1.0
func (d *DeferServer) StoreDeferTx(delayTx *tx.Tx)
StoreDeferTx stores a tx in defer server.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator This is the iterator
type SortedTxMap ¶
type SortedTxMap struct {
// contains filtered or unexported fields
}
SortedTxMap is a red black tree of tx.
func NewSortedTxMap ¶
func NewSortedTxMap() *SortedTxMap
NewSortedTxMap returns a new SortedTxMap instance.
func (*SortedTxMap) Iter ¶
func (st *SortedTxMap) Iter() *Iterator
Iter returns the iterator of SortedTxMap.
type TxPImpl ¶
type TxPImpl struct {
// contains filtered or unexported fields
}
TxPImpl defines all the API of txpool package.
func NewTxPoolImpl ¶
func NewTxPoolImpl(bChain block.Chain, blockCache blockcache.BlockCache, p2pService p2p.Service) (*TxPImpl, error)
NewTxPoolImpl returns a default TxPImpl instance.
func (*TxPImpl) AddDefertx ¶ added in v1.1.0
AddDefertx adds defer transaction.
func (*TxPImpl) AddLinkedNode ¶
func (pool *TxPImpl) AddLinkedNode(linkedNode *blockcache.BlockCacheNode) error
AddLinkedNode add the findBlock
func (*TxPImpl) GetFromChain ¶ added in v1.1.0
GetFromChain gets transaction from longest chain.
func (*TxPImpl) GetFromPending ¶ added in v1.1.0
GetFromPending gets transaction from pending list.
func (*TxPImpl) PendingTx ¶ added in v1.1.0
func (pool *TxPImpl) PendingTx() (*SortedTxMap, *blockcache.BlockCacheNode)
PendingTx is return pendingTx
type TxPool ¶
type TxPool interface { Start() error Stop() AddTx(tx *tx.Tx) error DelTx(hash []byte) error GetFromPending(hash []byte) (*tx.Tx, error) PendingTx() (*SortedTxMap, *blockcache.BlockCacheNode) // TODO: The following interfaces need to be moved from txpool to chainbase. AddLinkedNode(linkedNode *blockcache.BlockCacheNode) error ExistTxs(hash []byte, chainBlock *block.Block) FRet GetFromChain(hash []byte) (*tx.Tx, *tx.TxReceipt, error) }
TxPool defines all the API of txpool package.