Documentation ¶
Index ¶
- type Collector
- type HashMap
- func (m HashMap) Clone() []transactions.Transaction
- func (m *HashMap) Contains(txID []byte) bool
- func (m *HashMap) ContainsKeyImage(txInputKeyImage []byte) bool
- func (m *HashMap) Len() int
- func (m *HashMap) Put(t TxDesc) error
- func (m *HashMap) Range(fn func(k key, t TxDesc) error) error
- func (m *HashMap) Size() float64
- type Mempool
- type Pool
- type TxDesc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashMap ¶
type HashMap struct { Capacity uint32 // contains filtered or unexported fields }
HashMap represents a pool implementation based on golang map. The generic solution to bench against.
func (*HashMap) ContainsKeyImage ¶
ContainsKeyImage returns true if txpool includes a input that contains this keyImage
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(eventBus *wire.EventBus, verifyTx func(tx transactions.Transaction) error) *Mempool
NewMempool instantiates and initializes node mempool
func (*Mempool) Collect ¶
Collect process the emitted transactions. Fast-processing and simple impl to avoid locking here. NB This is always run in a different than main mempool routine
func (*Mempool) Run ¶
func (m *Mempool) Run()
Run spawns the mempool lifecycle routine. The whole mempool cycle is around getting input from the outside world (from input channels) and provide the actual list of the verified txs (onto output channel).
All operations are always executed in a single go-routine so no protection-by-mutex needed
type Pool ¶
type Pool interface { // Put sets the value for the given key. It overwrites any previous value // for that key; Put(t TxDesc) error // Contains returns true if the given key is in the pool. Contains(key []byte) bool // ContainsKeyImage returns true if txpool includes a input that contains // this keyImage ContainsKeyImage(keyImage []byte) bool // Clone the entire pool Clone() []transactions.Transaction // Pool sizing in KBs Size() float64 // Len returns the number of tx entries Len() int // Range iterates through all tx entries Range(fn func(k key, t TxDesc) error) error }
Pool represents a transaction pool of the verified txs only.