Skip to content

Commit f150473

Browse files
committed
core/filtermaps: removed debug prints
1 parent 1286e47 commit f150473

File tree

5 files changed

+38
-40
lines changed

5 files changed

+38
-40
lines changed

core/filtermaps/indexer.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package filtermaps
1818

1919
import (
20-
"fmt"
2120
"math"
2221
"sync"
2322

@@ -89,22 +88,22 @@ func NewIndexer(db ethdb.KeyValueStore, params *Params, config Config) *Indexer
8988
ix.updateTailEpoch()
9089
ix.updateActiveViewTailEpoch()
9190
ix.updateTailState()
92-
fmt.Println("init tail epoch", ix.tailEpoch, "tail target", ix.targetTailEpoch, "head number", ix.headNumber)
91+
//fmt.Println("init tail epoch", ix.tailEpoch, "tail target", ix.targetTailEpoch, "head number", ix.headNumber)
9392
return ix
9493
}
9594

9695
func (ix *Indexer) initMapBoundary(nextMap, limitMap uint32) *renderState {
97-
fmt.Println("initMapBoundary", nextMap, limitMap)
96+
//fmt.Println("initMapBoundary", nextMap, limitMap)
9897
rs := &renderState{
9998
params: ix.storage.params,
10099
renderRange: common.NewRange[uint32](nextMap, limitMap-nextMap),
101100
}
102101
for {
103102
nextMap = ix.storage.lastBoundaryBefore(nextMap)
104-
fmt.Println(" lbb", nextMap)
103+
//fmt.Println(" lbb", nextMap)
105104
if nextMap == 0 {
106105
// initialize at genesis
107-
fmt.Println(" genesis")
106+
//fmt.Println(" genesis")
108107
rs.currentMap = rs.params.newMemoryMap()
109108
return rs
110109
}
@@ -127,7 +126,7 @@ func (ix *Indexer) initMapBoundary(nextMap, limitMap uint32) *renderState {
127126
rs.nextBlock = lastNumber
128127
rs.partialBlock = true
129128
rs.partialBlockHash = lastHash
130-
fmt.Println(" nextBlock", rs.nextBlock, "mapIndex", rs.mapIndex)
129+
//fmt.Println(" nextBlock", rs.nextBlock, "mapIndex", rs.mapIndex)
131130
return rs
132131
}
133132
}
@@ -140,7 +139,7 @@ func (ix *Indexer) initSnapshot(snapshot *IndexView) *renderState {
140139
return nil
141140
}
142141

143-
fmt.Println("initSnapshot", snapshot.headBlockHash)
142+
//fmt.Println("initSnapshot", snapshot.headBlockHash)
144143
return &renderState{
145144
params: ix.storage.params,
146145
renderRange: common.NewRange[uint32](snapshot.headMapIndex, math.MaxUint32-snapshot.headMapIndex),
@@ -153,7 +152,7 @@ func (ix *Indexer) initSnapshot(snapshot *IndexView) *renderState {
153152
// Note that revertMaps might be called while headRenderer is nil and might set
154153
// headRenderer to nil.
155154
func (ix *Indexer) revertMaps(mapIndex uint32) {
156-
fmt.Println("revertMaps", mapIndex)
155+
//fmt.Println("revertMaps", mapIndex)
157156
if mapIndex < ix.storage.lastBoundaryBefore(math.MaxUint32) {
158157
for hash, iv := range ix.snapshots {
159158
if iv.firstMemoryMap > mapIndex {
@@ -437,8 +436,8 @@ func (ix *Indexer) needBlocks() common.Range[uint64] {
437436
}
438437

439438
func (ix *Indexer) Stop() {
440-
fmt.Println("/Stop")
441-
defer fmt.Println("\\Stop")
439+
/*fmt.Println("/Stop")
440+
defer fmt.Println("\\Stop")*/
442441

443442
ix.storage.stop()
444443
}

core/filtermaps/map_database.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ type writePatterItem struct {
356356

357357
// dirty: before setting write range to dirty
358358
func (m *mapDatabase) writeMaps(writeMaps, valid, dirty common.Range[uint32], maps map[uint32]*finishedMap, stopCallback func() bool) (bool, error) {
359-
fmt.Println("writeMaps", writeMaps, valid, dirty)
359+
//fmt.Println("writeMaps", writeMaps, valid, dirty)
360360
writePattern := m.makeWritePattern(writeMaps, valid, dirty)
361361
batch := m.db.NewBatch()
362362
rowsPerBatch := uint32(max(maxWritesPerBatch/len(writePattern), 1))
@@ -403,7 +403,7 @@ func (m *mapDatabase) writeMaps(writeMaps, valid, dirty common.Range[uint32], ma
403403
if err := batch.Write(); err != nil {
404404
return false, err
405405
}
406-
fmt.Println("writeMaps success")
406+
//fmt.Println("writeMaps success")
407407
return true, nil
408408
}
409409

core/filtermaps/map_storage.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ func newMapStorage(params *Params, mapDb *mapDatabase) *mapStorage {
7171
m.resetWithError(fmt.Sprintf("could not initialize valid block range: %v", err))
7272
}
7373
}
74-
fmt.Println("newMapStorage")
75-
fmt.Println(" valid:", m.valid)
76-
fmt.Println(" validBlocks:", m.validBlocks)
77-
fmt.Println(" dirty:", m.dirty)
78-
fmt.Println(" knownEpochs:", m.knownEpochs)
79-
fmt.Println(" knownEpochBlocks:", m.knownEpochBlocks)
74+
//fmt.Println("newMapStorage")
75+
//fmt.Println(" valid:", m.valid)
76+
//fmt.Println(" validBlocks:", m.validBlocks)
77+
//fmt.Println(" dirty:", m.dirty)
78+
//fmt.Println(" knownEpochs:", m.knownEpochs)
79+
//fmt.Println(" knownEpochBlocks:", m.knownEpochBlocks)
8080
m.closeWg.Add(1)
8181
go m.eventLoop()
8282
return m
@@ -197,7 +197,7 @@ func (m *mapStorage) addMap(mapIndex uint32, fm *finishedMap, forceCommit bool)
197197
if fm == nil {
198198
panic("trying to add nil map")
199199
}
200-
fmt.Println("addMap", mapIndex, forceCommit, m.overlay.count())
200+
//fmt.Println("addMap", mapIndex, forceCommit, m.overlay.count())
201201
if m.valid.includes(mapIndex) || m.overlay.includes(mapIndex) {
202202
panic("addMap to non-empty map index")
203203
}
@@ -223,14 +223,14 @@ func (m *mapStorage) deleteMaps(maps common.Range[uint32]) {
223223
m.lock.Lock()
224224
defer m.lock.Unlock()
225225

226-
fmt.Println("deleteMaps", maps)
226+
//fmt.Println("deleteMaps", maps)
227227
dr := rangeSet[uint32]{maps}
228228
for i := range dr.intersection(m.overlay).iter() {
229229
delete(m.maps, i)
230230
}
231-
fmt.Println(" overlay before", m.overlay)
231+
//fmt.Println(" overlay before", m.overlay)
232232
m.overlay = m.overlay.exclude(dr)
233-
fmt.Println(" overlay after", m.overlay)
233+
//fmt.Println(" overlay after", m.overlay)
234234
m.overlayUpdated()
235235
m.dirty = m.dirty.union(dr.intersection(m.valid))
236236
m.valid = m.valid.exclude(dr)
@@ -277,7 +277,7 @@ func (m *mapStorage) eventLoop() {
277277
select {
278278
case <-m.closeCh:
279279
stopped = true
280-
fmt.Println("STOPPED")
280+
//fmt.Println("STOPPED")
281281
case <-m.triggerCh:
282282
}
283283
}
@@ -286,7 +286,7 @@ func (m *mapStorage) eventLoop() {
286286
select {
287287
case <-m.closeCh:
288288
stopped = true
289-
fmt.Println("STOPPED")
289+
//fmt.Println("STOPPED")
290290
case <-m.triggerCh:
291291
default:
292292
}
@@ -326,7 +326,7 @@ func (m *mapStorage) eventLoop() {
326326
}
327327
//fmt.Println("e5")
328328
}
329-
fmt.Println("e6")
329+
//fmt.Println("e6")
330330
}
331331

332332
func (m *mapStorage) trigger() {
@@ -448,7 +448,7 @@ func (m *mapStorage) selectEpochTriggeredWrite() (uint32, bool) {
448448
if len(m.writeEpochs) == 0 {
449449
return 0, false
450450
}
451-
fmt.Println("selectEpochTriggeredWrite", m.writeEpochs)
451+
//fmt.Println("selectEpochTriggeredWrite", m.writeEpochs)
452452
epoch := m.writeEpochs[len(m.writeEpochs)-1].First()
453453
m.writeEpochs = m.writeEpochs.exclude(rangeSet[uint32]{common.NewRange[uint32](epoch, 1)})
454454
return epoch, true
@@ -464,7 +464,7 @@ func (m *mapStorage) selectEpochForcedWrite() (uint32, bool) {
464464
longest = r
465465
}
466466
}
467-
fmt.Println("selectEpochForcedWrite", m.overlay)
467+
//fmt.Println("selectEpochForcedWrite", m.overlay)
468468
return m.params.mapEpoch(longest.First()), true
469469
}
470470

@@ -483,7 +483,7 @@ func (m *mapStorage) selectEpochOnlyDirty() (uint32, bool) {
483483
if len(epochs) == 0 {
484484
return 0, false
485485
}
486-
fmt.Println("selectEpochForcedWrite", epochs, m.dirty, m.overlay)
486+
//fmt.Println("selectEpochForcedWrite", epochs, m.dirty, m.overlay)
487487
return epochs[0].First(), true
488488
}
489489

@@ -507,10 +507,10 @@ func (m *mapStorage) doWriteCycle(stopCallback func() bool) (bool, error) {
507507
writeMaps := epochRange.intersection(m.overlay).singleRange()
508508
validInEpoch := epochRange.intersection(m.valid).singleRange()
509509
dirtyInEpoch := epochRange.intersection(m.dirty).singleRange()
510-
fmt.Println("* epoch", epoch, epochRange)
511-
fmt.Println("* writeMaps", writeMaps, m.overlay)
512-
fmt.Println("* validInEpoch", validInEpoch, m.valid)
513-
fmt.Println("* dirtyInEpoch", dirtyInEpoch, m.dirty)
510+
//fmt.Println("* epoch", epoch, epochRange)
511+
//fmt.Println("* writeMaps", writeMaps, m.overlay)
512+
//fmt.Println("* validInEpoch", validInEpoch, m.valid)
513+
//fmt.Println("* dirtyInEpoch", dirtyInEpoch, m.dirty)
514514
// delete old pointers
515515
if !dirtyInEpoch.IsEmpty() {
516516
m.mapDb.deletePointers(m.extendPointerRange(dirtyInEpoch), stopCallback)

core/filtermaps/matcher.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (l *LogPosition) GetLog(receipts types.Receipts) (*types.Log, error) {
8080
// to that block range might be missing or incorrect.
8181
// Also note that the returned list may contain false positives.
8282
func GetPotentialMatches(ctx context.Context, backend *IndexView, firstBlock, lastBlock uint64, addresses []common.Address, topics [][]common.Hash) ([]LogPosition, error) {
83-
fmt.Println("GetPotentialMatches", firstBlock, lastBlock, addresses, topics)
83+
//fmt.Println("GetPotentialMatches", firstBlock, lastBlock, addresses, topics)
8484
params := backend.GetParams()
8585
// find the log value index range to search
8686
firstIndex, err := backend.GetBlockLvPointer(firstBlock)
@@ -94,7 +94,7 @@ func GetPotentialMatches(ctx context.Context, backend *IndexView, firstBlock, la
9494
if lastIndex > 0 {
9595
lastIndex--
9696
}
97-
fmt.Println(" lv range", firstIndex, lastIndex)
97+
//fmt.Println(" lv range", firstIndex, lastIndex)
9898

9999
// build matcher according to the given filter criteria
100100
matchers := make([]matcher, len(topics)+1)
@@ -149,7 +149,7 @@ func GetPotentialMatches(ctx context.Context, backend *IndexView, firstBlock, la
149149
log.Info("Get log stats")
150150
m.getLogStats.print()
151151
}
152-
fmt.Println("res", len(res))
152+
//fmt.Println("res", len(res))
153153
return res, err
154154
}
155155

@@ -472,9 +472,9 @@ func (m *singleMatcherInstance) getMatchesForLayer(layerIndex uint32) (results [
472472
for _, res := range results {
473473
r += len(res.matches)
474474
}
475-
fmt.Println("sm results", layerIndex, m.mapIndices[0], len(m.mapIndices), r, totalsize)
475+
//fmt.Println("sm results", layerIndex, m.mapIndices[0], len(m.mapIndices), r, totalsize)
476476
} else {
477-
fmt.Println("sm results *")
477+
//fmt.Println("sm results *")
478478
}
479479
m.cleanMapIndices()
480480
m.stats.setState(&st, stNone)

core/index_server.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package core
1919

2020
import (
21-
"fmt"
2221
"sync"
2322
"time"
2423

@@ -369,7 +368,7 @@ func (s *indexServer) setSuspended(suspended bool) {
369368
if (s.suspendCh != nil) == suspended {
370369
return
371370
}
372-
fmt.Println("setSuspended", suspended)
371+
//fmt.Println("setSuspended", suspended)
373372
if suspended {
374373
s.suspendCh = make(chan struct{})
375374
s.indexer.Suspended()
@@ -403,7 +402,7 @@ func (s *indexServer) sendHeadBlockData(headers []*types.Header, receipts []type
403402
}*/
404403
s.ready, s.needBlocks = s.indexer.AddBlockData(headers, receipts)
405404
if s.suspendCh != nil {
406-
fmt.Println("setSuspended false (head)")
405+
//fmt.Println("setSuspended false (head)")
407406
close(s.suspendCh)
408407
s.suspendCh = nil
409408
}

0 commit comments

Comments
 (0)