txpool

package
v0.0.0-...-9faecf3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: LGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MODULENAME = "txpool"
)

Variables

View Source
var (
	ErrQueueFull  = errors.New("queue full")
	ErrTxExist    = errors.New("transaction exists")
	ErrTxPoolFull = errors.New("transaction pool full")
)

Functions

This section is empty.

Types

type TransactionPool

type TransactionPool struct {
	// contains filtered or unexported fields
}

TransactionPool ... 1 池子里的交易按照nonce是否连续,分为乱序的和已经排序的在两个不同的队列中 2 已经排序好的可以被打包入块 3 池子里面的交易根据块中的各个地址的交易对应的Nonce进行删除

func NewTransactionPool

func NewTransactionPool(chainStore store.StoreInterface, journalPath string) *TransactionPool

NewTransactionPool 创建一个交易池

func (*TransactionPool) AddTransaction

func (pool *TransactionPool) AddTransaction(tx *types.Transaction, isLocal bool) error

AddTransaction 交易加入到txpool

func (*TransactionPool) GetMiniPendingNonce

func (pool *TransactionPool) GetMiniPendingNonce(addr *crypto.CommonAddress) uint64

GetMiniPendingNonce 获取Pending队列中的最小nonce

func (*TransactionPool) GetPending

func (pool *TransactionPool) GetPending(GasLimit *big.Int) []*types.Transaction

GetPending 打包过程获取交易,进行打包处理

func (*TransactionPool) GetQueue

func (pool *TransactionPool) GetQueue() []*types.Transaction

GetQueue 获取交易池中,非严格排序队列中的所有交易

func (*TransactionPool) GetTransactionCount

func (pool *TransactionPool) GetTransactionCount(address *crypto.CommonAddress) uint64

GetTransactionCount 获取总的交易个数,即获取地址对应的nonce

func (*TransactionPool) GetTransactions

func (pool *TransactionPool) GetTransactions(addr *crypto.CommonAddress) []types.Transactions

GetTransactions 获取当前池子中所有交易

func (*TransactionPool) GetTxInPool

func (pool *TransactionPool) GetTxInPool(hash string) (*types.Transaction, error)

GetTxInPool 获取交易池中的交易

func (*TransactionPool) NewTxFeed

func (pool *TransactionPool) NewTxFeed() *event.Feed

func (*TransactionPool) Start

func (pool *TransactionPool) Start(feed *event.Feed, tipRoot []byte)

Start 开启交易池

func (*TransactionPool) Stop

func (pool *TransactionPool) Stop()

Stop 停止交易池

Jump to

Keyboard shortcuts

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