txpool

package
v0.0.0-...-d82d076 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: MIT, GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TxpoolEventtype txpool event type.
	TxpoolEventtype event.EventType = 0x01
)

Variables

View Source
var (
	// ErrInvalidSender is returned if the transaction contains an invalid signature.
	ErrInvalidSender = errors.New("invalid sender")

	// ErrNonceTooLow is returned if the nonce of a transaction is lower than the
	// one present in the local chain.
	ErrNonceTooLow = errors.New("nonce too low")

	// ErrUnderpriced is returned if a transaction's gas price is below the minimum
	// configured for the transaction pool.
	ErrUnderpriced = errors.New("transaction underpriced")

	// ErrReplaceUnderpriced is returned if a transaction is attempted to be replaced
	// with a different one without the required price bump.
	ErrReplaceUnderpriced = errors.New("replacement transaction underpriced")

	// ErrInsufficientFunds is returned if the total cost of executing a transaction
	// is higher than the balance of the user's account.
	ErrInsufficientFunds = errors.New("insufficient funds for gas * price + value")

	// ErrIntrinsicGas is returned if the transaction is specified to use less gas
	// than required to start the invocation.
	ErrIntrinsicGas = errors.New("intrinsic gas too low")

	// ErrGasLimit is returned if a transaction's requested gas limit exceeds the
	// maximum allowance of the current block.
	ErrGasLimit = errors.New("exceeds block gas limit")

	// ErrNegativeValue is a sanity error to ensure noone is able to specify a
	// transaction with a negative value.
	ErrNegativeValue = errors.New("negative value")

	// ErrOversizedData is returned if the input data of a transaction is greater
	// than some meaningful limit a user might use. This is not a consensus error
	// making the transaction invalid, rather a DOS protection.
	ErrOversizedData = errors.New("oversized data")

	//ErrAsynError AsynSinger boe
	ErrAsynError = errors.New("ErrAsynError")
)
View Source
var INSTANCE = atomic.Value{}
View Source
var STOPPED = atomic.Value{}

Functions

This section is empty.

Types

type SendTxArgs

type SendTxArgs struct {
	From     common.Address  `json:"from"`
	To       *common.Address `json:"to"`
	Gas      *hexutil.Big    `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Value    *hexutil.Big    `json:"value"`
	Data     hexutil.Bytes   `json:"data"`
	ExData   types.TxExdata  `json:"exdata" rlp:"-"`
	Nonce    *hexutil.Uint64 `json:"nonce"`
}

SendTxArgs represents the arguments to submit a new transaction into the transaction pool.

type TxPool

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

TxPool contains all currently known transactions.

func GetTxPool

func GetTxPool() *TxPool

GetTxPool get txpool instance.

func NewTxPool

func NewTxPool(config config.TxPoolConfiguration, chainConfig *config.ChainConfig, blockChain blockChain) *TxPool

NewTxPool Create the transaction pool and start main process loop.

func (*TxPool) AddTx

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

AddTx attempts to queue a transactions if valid.

func (*TxPool) AddTxs

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

AddTxs attempts to queue a batch of transactions if they are valid.

func (*TxPool) Content

func (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)

Content returns txpool pending and queue content.

func (*TxPool) GetTxByHash

func (pool *TxPool) GetTxByHash(hash common.Hash) *types.Transaction

GetTxByHash Get returns a transaction if it is contained in the pool and nil otherwise.

func (*TxPool) GoTxsAsynSender

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

GoTxsAsynSender attempts to queue a batch of transactions if they are valid, whilst assuming the transaction pool lock is already held.

func (*TxPool) Pending

func (pool *TxPool) Pending() (map[common.Address]types.Transactions, error)

Pending retrieves all currently processable transactions, groupped by origin account and sorted by nonce. The returned transaction set is a copy and can be freely modified by calling code.

func (*TxPool) SetGasPrice

func (pool *TxPool) SetGasPrice(price *big.Int)

SetGasPrice updates the minimum price required by the transaction pool for a new transaction

func (*TxPool) Start

func (pool *TxPool) Start()

Start start txpool.

func (*TxPool) State

func (pool *TxPool) State() *state.ManagedState

State returns the virtual managed state of the transaction pool.

func (*TxPool) Stats

func (pool *TxPool) Stats() (int, int)

Stats retrieves the current pool stats, namely the number of pending and the number of queued (non-executable) transactions.

func (*TxPool) Stop

func (pool *TxPool) Stop()

Stop the transaction pool.

func (*TxPool) SubscribeTxPreEvent

func (pool *TxPool) SubscribeTxPreEvent(ch chan<- bc.TxPreEvent) sub.Subscription

SubscribeTxPreEvent ...

Jump to

Keyboard shortcuts

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