core/state: no need to prune block if the same (#1332)

This commit is contained in:
Delweng 2024-01-22 16:41:48 +08:00 committed by GitHub
parent ef462c2b47
commit a6a956263e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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 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 { 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") 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 var oldOffSet uint64