Documentation
¶
Index ¶
- Variables
- type HashMap
- func (m HashMap) Clone() []transactions.ContractCall
- func (m *HashMap) Close()
- func (m *HashMap) Contains(txID []byte) bool
- func (m *HashMap) Create(path string) error
- func (m *HashMap) Delete(txID []byte) error
- func (m HashMap) FilterByType(filterType transactions.TxType) []transactions.ContractCall
- func (m *HashMap) Get(txID []byte) transactions.ContractCall
- func (m *HashMap) Len() int
- func (m *HashMap) Put(t TxDesc) error
- func (m *HashMap) Range(fn func(k txHash, t TxDesc) error) error
- func (m *HashMap) RangeSort(fn func(k txHash, t TxDesc) (bool, error)) error
- func (m *HashMap) Size() uint32
- type Mempool
- func (m Mempool) GetUnconfirmedBalance(ctx context.Context, req *node.GetUnconfirmedBalanceRequest) (*node.BalanceResponse, error)
- func (m *Mempool) Loop(ctx context.Context)
- func (m *Mempool) OnClose()
- func (m *Mempool) ProcessTx(srcPeerID string, msg message.Message) ([]bytes.Buffer, error)
- func (m *Mempool) Run(ctx context.Context)
- func (m Mempool) SelectTx(ctx context.Context, req *node.SelectRequest) (*node.SelectResponse, error)
- type Pool
- type TxDesc
Constants ¶
This section is empty.
Variables ¶
var ( // ErrCoinbaseTxNotAllowed coinbase tx must be built by block generator only. ErrCoinbaseTxNotAllowed = errors.New("coinbase tx not allowed") // ErrAlreadyExists transaction with same txid already exists in. ErrAlreadyExists = errors.New("already exists") // ErrDoubleSpending transaction uses outputs spent in other mempool txs. ErrDoubleSpending = errors.New("double-spending in mempool") )
Functions ¶
This section is empty.
Types ¶
type HashMap ¶
type HashMap struct {
// spent key images from the transactions in the pool
// spentkeyImages map[keyImage]bool.
Capacity uint32
// contains filtered or unexported fields
}
HashMap represents a pool implementation based on golang map. The generic solution to bench against.
func (*HashMap) Close ¶ added in v0.4.4
func (m *HashMap) Close()
Close empty implementation of Pool.Close.
func (HashMap) FilterByType ¶ added in v0.3.0
func (m HashMap) FilterByType(filterType transactions.TxType) []transactions.ContractCall
FilterByType returns all transactions for a specific type that are currently in the HashMap.
func (*HashMap) Get ¶ added in v0.3.0
func (m *HashMap) Get(txID []byte) transactions.ContractCall
Get returns a tx for a given txID if it exists.
func (*HashMap) Put ¶
Put sets the value for the given key. It overwrites any previous value for that key.
type Mempool ¶
type Mempool struct {
// contains filtered or unexported fields
}
Mempool is a storage for the chain transactions that are valid according to the current chain state and can be included in the next block.
func NewMempool ¶
func NewMempool(db database.DB, eventBus *eventbus.EventBus, rpcBus *rpcbus.RPCBus, verifier transactions.UnconfirmedTxProber, srv *grpc.Server) *Mempool
NewMempool instantiates and initializes node mempool.
func (Mempool) GetUnconfirmedBalance ¶ added in v0.4.0
func (m Mempool) GetUnconfirmedBalance(ctx context.Context, req *node.GetUnconfirmedBalanceRequest) (*node.BalanceResponse, error)
GetUnconfirmedBalance will return the amount of DUSK that is in the mempool for a given key.
func (*Mempool) Loop ¶ added in v0.4.4
Loop listens for GetMempoolTxs request and topics.AcceptedBlock events.
func (*Mempool) OnClose ¶ added in v0.4.4
func (m *Mempool) OnClose()
OnClose performs mempool cleanup procedure. It's called on canceling mempool context.
func (Mempool) SelectTx ¶ added in v0.4.0
func (m Mempool) SelectTx(ctx context.Context, req *node.SelectRequest) (*node.SelectResponse, error)
SelectTx will return a view of the mempool, with optional filters applied.
type Pool ¶
type Pool interface {
// Create instantiates the underlying data storage.
Create(path string) error
// Put sets the value for the given key. It overwrites any previous value
// for that key.
Put(t TxDesc) error
// Get retrieves a transaction for a given txID, if it exists.
Get(txID []byte) transactions.ContractCall
// Contains returns true if the given key is in the pool.
Contains(key []byte) bool
// Delete a key in the pool.
Delete(key []byte) error
// Clone the entire pool.
Clone() []transactions.ContractCall
// FilterByType returns all verified transactions for a specific type.
FilterByType(transactions.TxType) []transactions.ContractCall
// Size is total number of bytes of all txs marshaling size.
Size() uint32
// Len returns the number of tx entries.
Len() int
// Range iterates through all tx entries.
Range(fn func(k txHash, t TxDesc) error) error
// RangeSort iterates through all tx entries sorted by Fee
// in a descending order.
RangeSort(fn func(k txHash, t TxDesc) (bool, error)) error
// Close closes backend.
Close()
}
Pool represents a transaction pool of the verified txs only.