pool: remove debug logs

This commit is contained in:
emailtovamos 2024-10-10 06:15:16 +01:00
parent 3e033ad1ec
commit 8f07ece544

View file

@ -2,7 +2,6 @@ package legacypool
import ( import (
"container/heap" "container/heap"
"fmt"
"sync" "sync"
"time" "time"
@ -80,7 +79,6 @@ func NewTxOverflowPoolHeap(estimatedMaxSize uint64) *TxOverflowPoolHeap {
func (tp *TxOverflowPoolHeap) Add(tx *types.Transaction) { func (tp *TxOverflowPoolHeap) Add(tx *types.Transaction) {
tp.mu.Lock() tp.mu.Lock()
defer tp.mu.Unlock() defer tp.mu.Unlock()
fmt.Println("heap.Add() called")
if _, exists := tp.index[tx.Hash()]; exists { if _, exists := tp.index[tx.Hash()]; exists {
// Transaction already in pool, ignore // Transaction already in pool, ignore
@ -95,7 +93,6 @@ func (tp *TxOverflowPoolHeap) Add(tx *types.Transaction) {
} }
delete(tp.index, oldestItem.tx.Hash()) delete(tp.index, oldestItem.tx.Hash())
tp.totalSize -= numSlots(oldestItem.tx) tp.totalSize -= numSlots(oldestItem.tx)
fmt.Println("about to decrease OverflowPool gauge")
} }
item := &txHeapItem{ item := &txHeapItem{
@ -105,7 +102,6 @@ func (tp *TxOverflowPoolHeap) Add(tx *types.Transaction) {
heap.Push(&tp.txHeap, item) heap.Push(&tp.txHeap, item)
tp.index[tx.Hash()] = item tp.index[tx.Hash()] = item
tp.totalSize += numSlots(tx) tp.totalSize += numSlots(tx)
fmt.Println("about to increase OverflowPool gauge")
} }
func (tp *TxOverflowPoolHeap) Get(hash common.Hash) (*types.Transaction, bool) { func (tp *TxOverflowPoolHeap) Get(hash common.Hash) (*types.Transaction, bool) {
@ -124,7 +120,6 @@ func (tp *TxOverflowPoolHeap) Remove(hash common.Hash) {
heap.Remove(&tp.txHeap, item.index) heap.Remove(&tp.txHeap, item.index)
delete(tp.index, hash) delete(tp.index, hash)
tp.totalSize -= numSlots(item.tx) tp.totalSize -= numSlots(item.tx)
fmt.Println("about to decrease OverflowPool gauge")
} }
} }
@ -144,8 +139,7 @@ func (tp *TxOverflowPoolHeap) Flush(n int) []*types.Transaction {
delete(tp.index, item.tx.Hash()) delete(tp.index, item.tx.Hash())
tp.totalSize -= numSlots(item.tx) tp.totalSize -= numSlots(item.tx)
} }
fmt.Println("flushing transactions", n)
fmt.Println("about to decrease OverflowPool gauge by n", n)
return txs return txs
} }
@ -160,13 +154,3 @@ func (tp *TxOverflowPoolHeap) Size() int {
defer tp.mu.RUnlock() defer tp.mu.RUnlock()
return tp.totalSize return tp.totalSize
} }
func (tp *TxOverflowPoolHeap) PrintTxStats() {
tp.mu.RLock()
defer tp.mu.RUnlock()
for _, item := range tp.txHeap {
tx := item.tx
fmt.Printf("Hash: %s, Timestamp: %d, GasFeeCap: %s, GasTipCap: %s\n",
tx.Hash().String(), item.timestamp, tx.GasFeeCap().String(), tx.GasTipCap().String())
}
}