Skip to content

pruning: Should not attempt to prune state store if no blocks were pruned #1615

@jmalicevic

Description

@jmalicevic

Bug Report

Setup

CometBFT version

main; v0.38.x-experimental

Have you tried the latest version: yes/no
yes

Config

Pruning is enabled.

What happened?

In the extreme case where pruning is triggered while the chain is at height 1 and the retain height is set to 1, no blocks can be pruned as they should not be. However, we still attempt to prune the state store and get an error that pruning failed.

What did you expect to happen?

If not blocks are pruned, there should be no attempt to prune the states.

How to reproduce it

The bug appeared in subsequent runs of the TestProvider test in http_test. The test added with the fix would fail if not for the changes fixing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions