rename DropTransactions -> Clear

This commit is contained in:
Jared Wasinger 2024-10-01 21:28:07 +07:00 committed by Felix Lange
parent 6738987786
commit 5842b1db62
5 changed files with 11 additions and 11 deletions

View file

@ -1715,14 +1715,14 @@ func (p *BlobPool) Status(hash common.Hash) txpool.TxStatus {
return txpool.TxStatusUnknown
}
// DropTransactions implements txpool.SubPool, removing all tracked transactions
// Clear implements txpool.SubPool, removing all tracked transactions
// from the blob pool and persistent store.
func (p *BlobPool) DropTransactions() {
func (p *BlobPool) Clear() {
p.lock.Lock()
defer p.lock.Unlock()
// manually iterating and deleting every entry is super sub-optimal
// However, DropTransactions is not currently used in production so
// However, Clear is not currently used in production so
// performance is not critical at the moment.
for _, entry := range p.lookup {
if err := p.store.Delete(entry); err != nil {

View file

@ -1962,9 +1962,9 @@ func numSlots(tx *types.Transaction) int {
return int((tx.Size() + txSlotSize - 1) / txSlotSize)
}
// DropTransactions implements txpool.SubPool, removing all tracked txs from the pool
// Clear implements txpool.SubPool, removing all tracked txs from the pool
// and rotating the journal.
func (p *LegacyPool) DropTransactions() {
func (p *LegacyPool) Clear() {
p.mu.Lock()
defer p.mu.Unlock()

View file

@ -169,6 +169,6 @@ type SubPool interface {
// identified by their hashes.
Status(hash common.Hash) TxStatus
// DropTransactions removes all tracked transactions from the pool
DropTransactions()
// Clear removes all tracked transactions from the pool
Clear()
}

View file

@ -498,9 +498,9 @@ func (p *TxPool) Sync() error {
}
}
// DropTransactions removes all tracked txs from the subpools.
func (p *TxPool) DropTransactions() {
// Clear removes all tracked txs from the subpools.
func (p *TxPool) Clear() {
for _, subpool := range p.subpools {
subpool.DropTransactions()
subpool.Clear()
}
}

View file

@ -285,7 +285,7 @@ func (c *SimulatedBeacon) Commit() common.Hash {
// Rollback un-sends previously added transactions.
func (c *SimulatedBeacon) Rollback() {
c.eth.TxPool().DropTransactions()
c.eth.TxPool().Clear()
}
// Fork sets the head to the provided hash.