mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
core/txpool: add notice to Add(..)
This commit is contained in:
parent
c1b9b76d7e
commit
66883c13e3
3 changed files with 13 additions and 6 deletions
|
|
@ -1311,6 +1311,9 @@ func (p *BlobPool) GetBlobs(vhashes []common.Hash) ([]*kzg4844.Blob, []*kzg4844.
|
||||||
|
|
||||||
// Add inserts a set of blob transactions into the pool if they pass validation (both
|
// Add inserts a set of blob transactions into the pool if they pass validation (both
|
||||||
// consensus validity and pool restrictions).
|
// consensus validity and pool restrictions).
|
||||||
|
//
|
||||||
|
// Note, if sync is set the method will block until all internal maintenance
|
||||||
|
// related to the add is finished. Only use this during tests for determinism.
|
||||||
func (p *BlobPool) Add(txs []*types.Transaction, sync bool) []error {
|
func (p *BlobPool) Add(txs []*types.Transaction, sync bool) []error {
|
||||||
var (
|
var (
|
||||||
adds = make([]*types.Transaction, 0, len(txs))
|
adds = make([]*types.Transaction, 0, len(txs))
|
||||||
|
|
|
||||||
|
|
@ -919,8 +919,8 @@ func (pool *LegacyPool) addRemoteSync(tx *types.Transaction) error {
|
||||||
|
|
||||||
// Add enqueues a batch of transactions into the pool if they are valid.
|
// Add enqueues a batch of transactions into the pool if they are valid.
|
||||||
//
|
//
|
||||||
// If sync is set, the method will block until all internal maintenance related
|
// Note, if sync is set the method will block until all internal maintenance
|
||||||
// to the add is finished. Only use this during tests for determinism!
|
// related to the add is finished. Only use this during tests for determinism.
|
||||||
func (pool *LegacyPool) Add(txs []*types.Transaction, sync bool) []error {
|
func (pool *LegacyPool) Add(txs []*types.Transaction, sync bool) []error {
|
||||||
// Filter out known ones without obtaining the pool lock or recovering signatures
|
// Filter out known ones without obtaining the pool lock or recovering signatures
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -409,6 +409,9 @@ func (p *TxPool) ValidateTxBasics(tx *types.Transaction) error {
|
||||||
// Add enqueues a batch of transactions into the pool if they are valid. Due
|
// Add enqueues a batch of transactions into the pool if they are valid. Due
|
||||||
// to the large transaction churn, add may postpone fully integrating the tx
|
// to the large transaction churn, add may postpone fully integrating the tx
|
||||||
// to a later point to batch multiple ones together.
|
// to a later point to batch multiple ones together.
|
||||||
|
//
|
||||||
|
// Note, if sync is set the method will block until all internal maintenance
|
||||||
|
// related to the add is finished. Only use this during tests for determinism.
|
||||||
func (p *TxPool) Add(txs []*types.Transaction, sync bool) []error {
|
func (p *TxPool) Add(txs []*types.Transaction, sync bool) []error {
|
||||||
// Split the input transactions between the subpools. It shouldn't really
|
// Split the input transactions between the subpools. It shouldn't really
|
||||||
// happen that we receive merged batches, but better graceful than strange
|
// happen that we receive merged batches, but better graceful than strange
|
||||||
|
|
@ -562,8 +565,8 @@ func (p *TxPool) Status(hash common.Hash) TxStatus {
|
||||||
// internal background reset operations. This method will run an explicit reset
|
// internal background reset operations. This method will run an explicit reset
|
||||||
// operation to ensure the pool stabilises, thus avoiding flakey behavior.
|
// operation to ensure the pool stabilises, thus avoiding flakey behavior.
|
||||||
//
|
//
|
||||||
// Note, do not use this in production / live code. In live code, the pool is
|
// Note, this method is only used for testing and is susceptible to DoS vectors.
|
||||||
// meant to reset on a separate thread to avoid DoS vectors.
|
// In production code, the pool is meant to reset on a separate thread.
|
||||||
func (p *TxPool) Sync() error {
|
func (p *TxPool) Sync() error {
|
||||||
sync := make(chan error)
|
sync := make(chan error)
|
||||||
select {
|
select {
|
||||||
|
|
@ -576,8 +579,9 @@ func (p *TxPool) Sync() error {
|
||||||
|
|
||||||
// Clear removes all tracked txs from the subpools.
|
// Clear removes all tracked txs from the subpools.
|
||||||
//
|
//
|
||||||
// Note, do not use this in production / live code. In live code, the pool is
|
// Note, this method invokes Sync() is only used for testing and is susceptible
|
||||||
// meant to reset on a separate thread to avoid DoS vectors.
|
// to DoS vectors. In production code, the pool is meant to reset on a separate
|
||||||
|
// thread.
|
||||||
func (p *TxPool) Clear() {
|
func (p *TxPool) Clear() {
|
||||||
// Invoke Sync to ensure that txs pending addition don't get added to the pool after
|
// Invoke Sync to ensure that txs pending addition don't get added to the pool after
|
||||||
// the subpools are subsequently cleared
|
// the subpools are subsequently cleared
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue