txpool

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2019 License: Apache-2.0 Imports: 8 Imported by: 8

README

txpool

A high-performance blockchain transaction pool.

Build Status codecov

Getting started

Running it then should be as simple as:

$ make all
Testing
$ make test

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTxPoolConfig = TxPoolConfig{
	GlobalSlots:    40960,
	MaxTrsPerBlock: 20480,
	TxMaxCacheTime: 600,
}

Functions

func GetPoolNonce

func GetPoolNonce(address types.Address) uint64

func GetTxByHash

func GetTxByHash(hash types.Hash) *types.Transaction

Types

type TxPool

type TxPool struct {
	// contains filtered or unexported fields
}
var GlobalTxsPool *TxPool

func (*TxPool) AddTx

func (pool *TxPool) AddTx(tx *types.Transaction) error

Adding transaction to the txpool

func (*TxPool) DelTxs

func (pool *TxPool) DelTxs(txs []*types.Transaction)

Update processing queue, clean txs from process and all queue.

func (*TxPool) GetTxs

func (pool *TxPool) GetTxs() []*types.Transaction

Get pending txs from txpool.

type TxPoolConfig

type TxPoolConfig struct {
	GlobalSlots    uint64 // Maximum number of executable transaction slots for txpool
	MaxTrsPerBlock uint64 // Maximum num of transactions a block
	TxMaxCacheTime uint64 // Maximum cache time(second) of transactions in tx pool
}

TxPoolConfig are the configuration parameters of the transaction pool.

type TxsPool

type TxsPool interface {
	// AddTx add a transaction to the txpool.
	AddTx(tx *types.Transaction) error

	// DelTxs delete the transactions which in processing queue.
	// Once a block was committed, transaction contained in the block can be removed.
	DelTxs(txs []*types.Transaction)

	// GetTxs gets the transactions which in pending status.
	GetTxs() []*types.Transaction
}

func NewTxPool

func NewTxPool(config TxPoolConfig, eventCenter types.EventCenter) TxsPool

NewTxPool creates a new transaction pool to gather, sort and filter inbound transactions from the network and local.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL