Documentation ¶
Index ¶
- Constants
- Variables
- func NewTxsPool(ctx context.Context, bc common.IBlockChain, depositContract *deposit.Deposit) (common.ITxsPool, error)
- type ReadState
- type StateCli
- type TxByNonce
- type TxsFetcher
- type TxsPool
- func (pool *TxsPool) AddLocal(tx *transaction.Transaction) error
- func (pool *TxsPool) AddLocals(txs []*transaction.Transaction) []error
- func (pool *TxsPool) AddRemotes(txs []*transaction.Transaction) []error
- func (pool *TxsPool) Content() (map[types.Address][]*transaction.Transaction, ...)
- func (pool *TxsPool) GetTransaction() (txs []*transaction.Transaction, err error)
- func (pool *TxsPool) GetTx(hash types.Hash) *transaction.Transaction
- func (pool *TxsPool) Has(hash types.Hash) bool
- func (pool *TxsPool) Nonce(addr types.Address) uint64
- func (pool *TxsPool) Pending(enforceTips bool) map[types.Address][]*transaction.Transaction
- func (pool *TxsPool) ResetState(blockHash types.Hash) error
- func (pool *TxsPool) Stats() (int, int, int, int)
- func (pool *TxsPool) StatsPrint()
- func (pool *TxsPool) Stop() error
- type TxsPoolConfig
Constants ¶
View Source
const ( BloomFetcherMaxTime = 10 * time.Minute BloomSendTransactionTime = 10 * time.Second BloomSendMaxTransactions = 100 )
Variables ¶
View Source
var ( ErrAlreadyKnown = fmt.Errorf("already known") ErrInvalidSender = fmt.Errorf("invalid sender") ErrOversizedData = fmt.Errorf("oversized data") ErrNegativeValue = fmt.Errorf("negative value") ErrGasLimit = fmt.Errorf("exceeds block gas limit") ErrUnderpriced = fmt.Errorf("transaction underpriced") ErrTxPoolOverflow = fmt.Errorf("txpool is full") ErrReplaceUnderpriced = fmt.Errorf("replacement transaction underpriced") ErrFeeCapVeryHigh = fmt.Errorf("max fee per gas higher than 2^256-1") ErrNonceTooLow = fmt.Errorf("nonce too low") ErrNonceTooHigh = fmt.Errorf("nonce too high") ErrInsufficientFunds = fmt.Errorf("insufficient funds for gas * price + value") // ErrTipAboveFeeCap is a sanity error to ensure no one is able to specify a // transaction with a tip higher than the total fee cap. ErrTipAboveFeeCap = fmt.Errorf("max priority fee per gas higher than max fee per gas") )
View Source
var DefaultTxPoolConfig = TxsPoolConfig{ PriceLimit: 1, PriceBump: 10, AccountSlots: 16, GlobalSlots: 4096 + 1024, AccountQueue: 64, GlobalQueue: 1024, Lifetime: 3 * time.Hour, }
DefaultTxPoolConfig default blockchain
View Source
var (
ErrBadPeer = fmt.Errorf("bad peer error")
)
Functions ¶
Types ¶
type ReadState ¶
type TxByNonce ¶
type TxByNonce []*transaction.Transaction
TxByNonce implements the sort interface to allow sorting a list of transactions by their nonces.
type TxsFetcher ¶
type TxsFetcher struct {
// contains filtered or unexported fields
}
func NewTxsFetcher ¶
func NewTxsFetcher(ctx context.Context, getTx func(hash types.Hash) *transaction.Transaction, addTxs func([]*transaction.Transaction) []error, pendingTxs func(enforceTips bool) map[types.Address][]*transaction.Transaction, p2pServer common.INetwork, peers common.PeerMap, bloom *types.Bloom) *TxsFetcher
func (TxsFetcher) ConnHandler ¶
func (f TxsFetcher) ConnHandler(data []byte, ID peer.ID) error
ConnHandler handler peer message
func (TxsFetcher) Start ¶
func (f TxsFetcher) Start() error
type TxsPool ¶
type TxsPool struct {
// contains filtered or unexported fields
}
func (*TxsPool) AddLocal ¶
func (pool *TxsPool) AddLocal(tx *transaction.Transaction) error
AddLocal
func (*TxsPool) AddLocals ¶
func (pool *TxsPool) AddLocals(txs []*transaction.Transaction) []error
AddLocals
func (*TxsPool) AddRemotes ¶
func (pool *TxsPool) AddRemotes(txs []*transaction.Transaction) []error
AddRemotes
func (*TxsPool) Content ¶
func (pool *TxsPool) Content() (map[types.Address][]*transaction.Transaction, map[types.Address][]*transaction.Transaction)
Content
func (*TxsPool) GetTransaction ¶
func (pool *TxsPool) GetTransaction() (txs []*transaction.Transaction, err error)
GetTransaction
func (*TxsPool) Pending ¶
func (pool *TxsPool) Pending(enforceTips bool) map[types.Address][]*transaction.Transaction
Pending retrieves all currently processable transactions, grouped by origin account and sorted by nonce. The returned transaction set is a copy and can be freely modified by calling code.
The enforceTips parameter can be used to do an extra filtering on the pending transactions and only return those whose **effective** tip is large enough in the next pending execution environment.
Click to show internal directories.
Click to hide internal directories.