Documentation ¶
Index ¶
- Variables
- func IntrinsicGas(accountDB *accountmanager.AccountManager, action *types.Action) (uint64, error)
- type Config
- type TransactionWithPath
- type TxPool
- func (tp *TxPool) AddLocal(tx *types.Transaction) error
- func (tp *TxPool) AddLocals(txs []*types.Transaction) []error
- func (tp *TxPool) AddRemote(tx *types.Transaction) error
- func (tp *TxPool) AddRemotes(txs []*types.Transaction) []error
- func (tp *TxPool) Content() (map[common.Name][]*types.Transaction, map[common.Name][]*types.Transaction)
- func (tp *TxPool) GasPrice() *big.Int
- func (tp *TxPool) Get(hash common.Hash) *types.Transaction
- func (tp *TxPool) Pending() (map[common.Name][]*types.Transaction, error)
- func (tp *TxPool) SetGasPrice(price *big.Int)
- func (tp *TxPool) State() *am.AccountManager
- func (tp *TxPool) Stats() (int, int)
- func (tp *TxPool) Status(hashes []common.Hash) []TxStatus
- func (tp *TxPool) Stop()
- type TxStatus
- type TxpoolStation
Constants ¶
This section is empty.
Variables ¶
var ( // ErrOutOfGas is returned if the transaction executing out of gas ErrOutOfGas = errors.New("out of gas") // 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") // ErrInsufficientFundsForGas is returned if the gas cost of executing a transaction // is higher than the balance of the user's account. ErrInsufficientFundsForGas = errors.New("insufficient funds for gas * price") // ErrInsufficientFundsForValue is returned if the value cost of executing a transaction // is higher than the balance of the user's account. ErrInsufficientFundsForValue = errors.New("insufficient funds for 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") )
var DefaultTxPoolConfig = &Config{ Journal: "transactions.rlp", Rejournal: time.Hour, PriceLimit: 1000000000, PriceBump: 10, AccountSlots: 128, GlobalSlots: 4096, AccountQueue: 1280, GlobalQueue: 4096, Lifetime: 3 * time.Hour, ResendTime: 10 * time.Minute, }
DefaultTxPoolConfig default txpool config
var SenderCacher = newTxSenderCacher(runtime.NumCPU())
SenderCacher is a concurrent tranaction sender recoverer anc cacher.
Functions ¶
func IntrinsicGas ¶
func IntrinsicGas(accountDB *accountmanager.AccountManager, action *types.Action) (uint64, error)
IntrinsicGas computes the 'intrinsic gas' for a message with the given data.
Types ¶
type Config ¶
type Config struct { NoLocals bool `mapstructure:"nolocals"` // Whether local transaction handling should be disabled Journal string `mapstructure:"journal"` // Journal of local transactions to survive node restarts Rejournal time.Duration `mapstructure:"rejournal"` // Time interval to regenerate the local transaction journal PriceLimit uint64 `mapstructure:"pricelimit"` // Minimum gas price to enforce for acceptance into the pool PriceBump uint64 `mapstructure:"pricebump"` // Minimum price bump percentage to replace an already existing transaction (nonce) AccountSlots uint64 `mapstructure:"accountslots"` // Minimum number of executable transaction slots guaranteed per account GlobalSlots uint64 `mapstructure:"globalslots"` // Maximum number of executable transaction slots for all accounts AccountQueue uint64 `mapstructure:"accountqueue"` // Maximum number of non-executable transaction slots permitted per account GlobalQueue uint64 `mapstructure:"globalqueue"` // Maximum number of non-executable transaction slots for all accounts Lifetime time.Duration `mapstructure:"lifetime"` // Maximum amount of time non-executable transaction are queued ResendTime time.Duration `mapstructure:"resendtime"` // Maximum amount of time executable transaction are resended GasAssetID uint64 }
Config are the configuration parameters of the transaction pool.
type TransactionWithPath ¶ added in v0.0.8
type TransactionWithPath struct { Tx *types.Transaction Bloom *types.Bloom }
TransactionWithPath is the network packet for the transactions.
type TxPool ¶
type TxPool struct {
// contains filtered or unexported fields
}
TxPool contains all currently known transactions.
func New ¶
func New(config Config, chainconfig *params.ChainConfig, bc blockChain) *TxPool
New creates a new transaction pool to gather, sort and filter inbound transactions from the network.
func (*TxPool) AddLocal ¶
func (tp *TxPool) AddLocal(tx *types.Transaction) error
AddLocal enqueues a single transaction into the pool if it is valid, marking the sender as a local one in the mean time, ensuring it goes around the local pricing constraints.
func (*TxPool) AddLocals ¶
func (tp *TxPool) AddLocals(txs []*types.Transaction) []error
AddLocals enqueues a batch of transactions into the pool if they are valid, marking the senders as a local ones in the mean time, ensuring they go around the local pricing constraints.
func (*TxPool) AddRemote ¶
func (tp *TxPool) AddRemote(tx *types.Transaction) error
AddRemote enqueues a single transaction into the pool if it is valid. If the sender is not among the locally tracked ones, full pricing constraints will apply.
func (*TxPool) AddRemotes ¶
func (tp *TxPool) AddRemotes(txs []*types.Transaction) []error
AddRemotes enqueues a batch of transactions into the pool if they are valid. If the senders are not among the locally tracked ones, full pricing constraints will apply.
func (*TxPool) Content ¶
func (tp *TxPool) Content() (map[common.Name][]*types.Transaction, map[common.Name][]*types.Transaction)
Content retrieves the data content of the transaction pool, returning all the pending as well as queued transactions, grouped by account and sorted by nonce.
func (*TxPool) Get ¶
func (tp *TxPool) Get(hash common.Hash) *types.Transaction
Get returns a transaction if it is contained in the pool and nil otherwise.
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, and drops all transactions below this threshold.
func (*TxPool) State ¶
func (tp *TxPool) State() *am.AccountManager
State returns the virtual managed state of the transaction tp.
func (*TxPool) Stats ¶
Stats retrieves the current pool stats, namely the number of pending and the number of queued (non-executable) transactions.
type TxStatus ¶
type TxStatus uint
TxStatus is the current status of a transaction as seen by the tp.
type TxpoolStation ¶
type TxpoolStation struct {
// contains filtered or unexported fields
}
TxpoolStation is responsible for transaction broadcasting and receiving
func NewTxpoolStation ¶
func NewTxpoolStation(txpool *TxPool) *TxpoolStation
NewTxpoolStation create a new TxpoolStation
func (*TxpoolStation) Stop ¶ added in v0.0.15
func (s *TxpoolStation) Stop()