From aaa29e7ffd6f878061ec86667b7d5db9b58bed05 Mon Sep 17 00:00:00 2001 From: Delweng Date: Thu, 2 Mar 2023 10:16:19 +0800 Subject: [PATCH] core/state: no need to prune block if the same Signed-off-by: Delweng --- core/state/pruner/pruner.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/state/pruner/pruner.go b/core/state/pruner/pruner.go index 83c56d5785..2f7d8851c4 100644 --- a/core/state/pruner/pruner.go +++ b/core/state/pruner/pruner.go @@ -378,8 +378,11 @@ func (p *BlockPruner) backUpOldDb(name string, cache, handles int, namespace str // If the items in freezer is less than the block amount that we want to reserve, it is not enough, should stop. if itemsOfAncient < p.BlockAmountReserved { - log.Error("the number of old blocks is not enough to reserve,", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved) + log.Error("the number of old blocks is not enough to reserve", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved) return errors.New("the number of old blocks is not enough to reserve") + } else if itemsOfAncient == p.BlockAmountReserved { + log.Error("the number of old blocks is the same to be reserved", "ancient items", itemsOfAncient, "the amount specified", p.BlockAmountReserved) + return errors.New("the number of old blocks is the same to be reserved") } var oldOffSet uint64