Documentation
¶
Index ¶
- Constants
- Variables
- type SendTxArgs
- type TxPool
- func (pool *TxPool) AddTx(tx *types.Transaction) error
- func (pool *TxPool) AddTxs(txs []*types.Transaction) error
- func (pool *TxPool) Content() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)
- func (pool *TxPool) GetTxByHash(hash common.Hash) *types.Transaction
- func (pool *TxPool) GoTxsAsynSender(txs []*types.Transaction) error
- func (pool *TxPool) Pending() (map[common.Address]types.Transactions, error)
- func (pool *TxPool) SetGasPrice(price *big.Int)
- func (pool *TxPool) Start()
- func (pool *TxPool) State() *state.ManagedState
- func (pool *TxPool) Stats() (int, int)
- func (pool *TxPool) Stop()
- func (pool *TxPool) SubscribeTxPreEvent(ch chan<- bc.TxPreEvent) sub.Subscription
- type Txchevent
Constants ¶
const (
TxpoolEventtype event.EventType = 0x01
)
Variables ¶
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") // ErrTxPoolFull is returned if the pool is full. ErrTxPoolFull = errors.New("txpool full") //AsynSinger boe ErrAsynError = errors.New("ErrAsynError") )
var INSTANCE = atomic.Value{}
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:"-"` //ExData hexutil.Bytes `json:"exdata"` 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
}
func NewTxPool ¶
func NewTxPool(config config.TxPoolConfiguration, chainConfig *config.ChainConfig, blockChain blockChain) *TxPool
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)
func (*TxPool) GetTxByHash ¶
func (pool *TxPool) GetTxByHash(hash common.Hash) *types.Transaction
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
addTxsLocked attempts to queue a batch of transactions if they are valid, whilst assuming the transaction pool lock is already held.
func (*TxPool) Pending ¶
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 ¶
SetGasPrice updates the minimum price required by the transaction pool for a new transaction
func (*TxPool) State ¶
func (pool *TxPool) State() *state.ManagedState
State returns the virtual managed state of the transaction pool.
func (*TxPool) Stats ¶
stats retrieves the current pool stats, namely the number of pending and the number of queued (non-executable) transactions.
func (*TxPool) SubscribeTxPreEvent ¶
func (pool *TxPool) SubscribeTxPreEvent(ch chan<- bc.TxPreEvent) sub.Subscription
type Txchevent ¶
type Txchevent struct {
Tx *types.Transaction
}