Skip to content

Commit 1bbd4b8

Browse files
committed
core/state: no need to prune block if specified reserve blocks is the same to items in ancient
Signed-off-by: Delweng <delweng@gmail.com>
1 parent 109a8e7 commit 1bbd4b8

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

core/state/pruner/pruner.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,11 @@ func (p *BlockPruner) backUpOldDb(name string, cache, handles int, namespace str
378378

379379
// If the items in freezer is less than the block amount that we want to reserve, it is not enough, should stop.
380380
if itemsOfAncient < p.BlockAmountReserved {
381-
log.Error("the number of old blocks is not enough to reserve,", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved)
381+
log.Error("the number of old blocks is not enough to reserve", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved)
382382
return errors.New("the number of old blocks is not enough to reserve")
383+
} else if itemsOfAncient == p.BlockAmountReserved {
384+
log.Error("the number of old blocks is the same to be reserved", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved)
385+
return errors.New("the number of old blocks is the same to be reserved")
383386
}
384387

385388
var oldOffSet uint64

tests/testdata

0 commit comments

Comments
 (0)