mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
all: remove unnecessary type arguments for NewRange
This commit is contained in:
parent
c9610fbf57
commit
f27166ce94
2 changed files with 10 additions and 10 deletions
|
|
@ -202,8 +202,8 @@ func NewFilterMaps(db ethdb.KeyValueStore, initView *ChainView, historyCutoff, f
|
||||||
initialized: initialized,
|
initialized: initialized,
|
||||||
headIndexed: rs.HeadIndexed,
|
headIndexed: rs.HeadIndexed,
|
||||||
headDelimiter: rs.HeadDelimiter,
|
headDelimiter: rs.HeadDelimiter,
|
||||||
blocks: common.NewRange[uint64](rs.BlocksFirst, rs.BlocksAfterLast-rs.BlocksFirst),
|
blocks: common.NewRange(rs.BlocksFirst, rs.BlocksAfterLast-rs.BlocksFirst),
|
||||||
maps: common.NewRange[uint32](rs.MapsFirst, rs.MapsAfterLast-rs.MapsFirst),
|
maps: common.NewRange(rs.MapsFirst, rs.MapsAfterLast-rs.MapsFirst),
|
||||||
tailPartialEpoch: rs.TailPartialEpoch,
|
tailPartialEpoch: rs.TailPartialEpoch,
|
||||||
},
|
},
|
||||||
matcherSyncCh: make(chan *FilterMapsMatcherBackend),
|
matcherSyncCh: make(chan *FilterMapsMatcherBackend),
|
||||||
|
|
@ -327,8 +327,8 @@ func (f *FilterMaps) init() error {
|
||||||
}
|
}
|
||||||
if bestLen > 0 {
|
if bestLen > 0 {
|
||||||
cp := checkpoints[bestIdx][bestLen-1]
|
cp := checkpoints[bestIdx][bestLen-1]
|
||||||
fmr.blocks = common.NewRange[uint64](cp.BlockNumber+1, 0)
|
fmr.blocks = common.NewRange(cp.BlockNumber+1, 0)
|
||||||
fmr.maps = common.NewRange[uint32](uint32(bestLen)<<f.logMapsPerEpoch, 0)
|
fmr.maps = common.NewRange(uint32(bestLen)<<f.logMapsPerEpoch, 0)
|
||||||
}
|
}
|
||||||
f.setRange(batch, f.targetView, fmr)
|
f.setRange(batch, f.targetView, fmr)
|
||||||
return batch.Write()
|
return batch.Write()
|
||||||
|
|
@ -669,15 +669,15 @@ func (f *FilterMaps) deleteTailEpoch(epoch uint32) error {
|
||||||
f.setRange(f.db, f.indexedView, fmr)
|
f.setRange(f.db, f.indexedView, fmr)
|
||||||
first := f.mapRowIndex(firstMap, 0)
|
first := f.mapRowIndex(firstMap, 0)
|
||||||
count := f.mapRowIndex(firstMap+f.mapsPerEpoch, 0) - first
|
count := f.mapRowIndex(firstMap+f.mapsPerEpoch, 0) - first
|
||||||
rawdb.DeleteFilterMapRows(f.db, common.NewRange[uint64](first, count))
|
rawdb.DeleteFilterMapRows(f.db, common.NewRange(first, count))
|
||||||
for mapIndex := firstMap; mapIndex < firstMap+f.mapsPerEpoch; mapIndex++ {
|
for mapIndex := firstMap; mapIndex < firstMap+f.mapsPerEpoch; mapIndex++ {
|
||||||
f.filterMapCache.Remove(mapIndex)
|
f.filterMapCache.Remove(mapIndex)
|
||||||
}
|
}
|
||||||
rawdb.DeleteFilterMapLastBlocks(f.db, common.NewRange[uint32](firstMap, f.mapsPerEpoch-1)) // keep last enrty
|
rawdb.DeleteFilterMapLastBlocks(f.db, common.NewRange(firstMap, f.mapsPerEpoch-1)) // keep last enrty
|
||||||
for mapIndex := firstMap; mapIndex < firstMap+f.mapsPerEpoch-1; mapIndex++ {
|
for mapIndex := firstMap; mapIndex < firstMap+f.mapsPerEpoch-1; mapIndex++ {
|
||||||
f.lastBlockCache.Remove(mapIndex)
|
f.lastBlockCache.Remove(mapIndex)
|
||||||
}
|
}
|
||||||
rawdb.DeleteBlockLvPointers(f.db, common.NewRange[uint64](firstBlock, lastBlock-firstBlock)) // keep last enrty
|
rawdb.DeleteBlockLvPointers(f.db, common.NewRange(firstBlock, lastBlock-firstBlock)) // keep last enrty
|
||||||
for blockNumber := firstBlock; blockNumber < lastBlock; blockNumber++ {
|
for blockNumber := firstBlock; blockNumber < lastBlock; blockNumber++ {
|
||||||
f.lvPointerCache.Remove(blockNumber)
|
f.lvPointerCache.Remove(blockNumber)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ func (s *searchSession) syncMatcher(trimTailThreshold uint64) error {
|
||||||
// update actual search range based on current head number
|
// update actual search range based on current head number
|
||||||
first := min(s.firstBlock, s.syncRange.HeadNumber)
|
first := min(s.firstBlock, s.syncRange.HeadNumber)
|
||||||
last := min(s.lastBlock, s.syncRange.HeadNumber)
|
last := min(s.lastBlock, s.syncRange.HeadNumber)
|
||||||
s.searchRange = common.NewRange[uint64](first, last+1-first)
|
s.searchRange = common.NewRange(first, last+1-first)
|
||||||
// discard everything that is not needed or might be invalid
|
// discard everything that is not needed or might be invalid
|
||||||
trimRange := s.syncRange.ValidBlocks
|
trimRange := s.syncRange.ValidBlocks
|
||||||
if trimRange.First() <= trimTailThreshold {
|
if trimRange.First() <= trimTailThreshold {
|
||||||
|
|
@ -296,7 +296,7 @@ func (s *searchSession) doSearchIteration() error {
|
||||||
case !s.matchRange.IsEmpty() && s.matchRange.First() > s.searchRange.First():
|
case !s.matchRange.IsEmpty() && s.matchRange.First() > s.searchRange.First():
|
||||||
// we have results but tail section is missing; do unindexed search for
|
// we have results but tail section is missing; do unindexed search for
|
||||||
// the tail part but still allow indexed search for missing head section
|
// the tail part but still allow indexed search for missing head section
|
||||||
tailRange := common.NewRange[uint64](s.searchRange.First(), s.matchRange.First()-s.searchRange.First())
|
tailRange := common.NewRange(s.searchRange.First(), s.matchRange.First()-s.searchRange.First())
|
||||||
tailMatches, err := s.searchInRange(tailRange, false)
|
tailMatches, err := s.searchInRange(tailRange, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
@ -307,7 +307,7 @@ func (s *searchSession) doSearchIteration() error {
|
||||||
|
|
||||||
case !s.matchRange.IsEmpty() && s.matchRange.First() == s.searchRange.First() && s.searchRange.AfterLast() > s.matchRange.AfterLast():
|
case !s.matchRange.IsEmpty() && s.matchRange.First() == s.searchRange.First() && s.searchRange.AfterLast() > s.matchRange.AfterLast():
|
||||||
// we have results but head section is missing
|
// we have results but head section is missing
|
||||||
headRange := common.NewRange[uint64](s.matchRange.AfterLast(), s.searchRange.AfterLast()-s.matchRange.AfterLast())
|
headRange := common.NewRange(s.matchRange.AfterLast(), s.searchRange.AfterLast()-s.matchRange.AfterLast())
|
||||||
if !s.forceUnindexed {
|
if !s.forceUnindexed {
|
||||||
indexedHeadRange := headRange.Intersection(s.syncRange.IndexedBlocks)
|
indexedHeadRange := headRange.Intersection(s.syncRange.IndexedBlocks)
|
||||||
if !indexedHeadRange.IsEmpty() && indexedHeadRange.First() == headRange.First() {
|
if !indexedHeadRange.IsEmpty() && indexedHeadRange.First() == headRange.First() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue