mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
filtermaps support history pruning cutoff point
This commit is contained in:
parent
0712715cb0
commit
d39ffe6873
1 changed files with 3 additions and 3 deletions
|
|
@ -161,13 +161,13 @@ func (f *FilterMaps) lastCanonicalSnapshotOfMap(mapIndex uint32) *renderedMap {
|
||||||
// and starting log value pointer of the last block is also returned.
|
// and starting log value pointer of the last block is also returned.
|
||||||
func (f *FilterMaps) lastCanonicalMapBoundaryBefore(renderBefore uint32) (nextMap uint32, startBlock, startLvPtr uint64, err error) {
|
func (f *FilterMaps) lastCanonicalMapBoundaryBefore(renderBefore uint32) (nextMap uint32, startBlock, startLvPtr uint64, err error) {
|
||||||
if !f.indexedRange.initialized {
|
if !f.indexedRange.initialized {
|
||||||
return 0, 0, 0, nil
|
return 0, f.historyCutoff, 0, nil
|
||||||
}
|
}
|
||||||
mapIndex := renderBefore
|
mapIndex := renderBefore
|
||||||
for {
|
for {
|
||||||
var ok bool
|
var ok bool
|
||||||
if mapIndex, ok = f.lastMapBoundaryBefore(mapIndex); !ok {
|
if mapIndex, ok = f.lastMapBoundaryBefore(mapIndex); !ok {
|
||||||
return 0, 0, 0, nil
|
return 0, f.historyCutoff, 0, nil
|
||||||
}
|
}
|
||||||
lastBlock, lastBlockId, err := f.getLastBlockOfMap(mapIndex)
|
lastBlock, lastBlockId, err := f.getLastBlockOfMap(mapIndex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -229,7 +229,7 @@ func (f *FilterMaps) loadHeadSnapshot() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to retrieve last block of head snapshot map %d: %v", f.indexedRange.maps.Last(), err)
|
return fmt.Errorf("failed to retrieve last block of head snapshot map %d: %v", f.indexedRange.maps.Last(), err)
|
||||||
}
|
}
|
||||||
var firstBlock uint64
|
var firstBlock uint64 = f.historyCutoff
|
||||||
if f.indexedRange.maps.AfterLast() > 1 {
|
if f.indexedRange.maps.AfterLast() > 1 {
|
||||||
prevLastBlock, _, err := f.getLastBlockOfMap(f.indexedRange.maps.Last() - 1)
|
prevLastBlock, _, err := f.getLastBlockOfMap(f.indexedRange.maps.Last() - 1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue