txpool

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PackSize  int           //how many transactions should the primary pack
	BlockTick time.Duration //block packaging time period
	PoolSize  int           //how many transactions could the txPool stores in total
	SetSize   int           //how many transactions should the node broadcast at once
}

type TxPool

type TxPool struct {
	sync.RWMutex //lock for the pendingTxs
	// contains filtered or unexported fields
}

func New

func New(config *order.Config, storage storage.Storage, txPoolConfig *Config) (*TxPool, chan *raftproto.Ready)

New txpool

func (*TxPool) AddPendingTx

func (tp *TxPool) AddPendingTx(tx *pb.Transaction, isAckTx bool) error

AddPendingTx add pending transaction into txpool

func (*TxPool) BatchDelete

func (tp *TxPool) BatchDelete(hashes []types.Hash)

BatchDelete batch delete txs

func (*TxPool) BatchStore

func (tp *TxPool) BatchStore(hashes []types.Hash)

BatchStore batch store txs

func (*TxPool) Broadcast

func (tp *TxPool) Broadcast(tx *pb.Transaction) error

Broadcast the new transaction to other nodes

func (*TxPool) BuildReqLookUp

func (tp *TxPool) BuildReqLookUp()

BuildReqLookUp store the bloom filter

func (*TxPool) CheckExecute

func (tp *TxPool) CheckExecute(isLeader bool)

CheckExecute check the txpool status, only leader node can run Execute()

func (*TxPool) FetchTx

func (tp *TxPool) FetchTx(hash types.Hash, height uint64) *pb.Transaction

Fetch tx by local txpool or network

func (*TxPool) GetHeight

func (tp *TxPool) GetHeight() uint64

GetHeight get current block height

func (*TxPool) GetTx

func (tp *TxPool) GetTx(hash types.Hash, findByStore bool) (*pb.Transaction, bool)

GetTx get the transaction by txpool or ledger

func (*TxPool) PoolSize

func (tp *TxPool) PoolSize() int

Current txpool's size

func (*TxPool) RemoveTxs

func (tp *TxPool) RemoveTxs(hashes []types.Hash, isLeader bool)

RemoveTxs remove txs from the cache

func (*TxPool) UpdateHeight

func (tp *TxPool) UpdateHeight() uint64

UpdateHeight add the block height

Jump to

Keyboard shortcuts

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