Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
  • Loading branch information
joshua-kim committed Apr 4, 2024
1 parent 6dfaa6f commit d529a1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vms/proposervm/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ func (s *state) pruneVerifiedBlocks(db *versiondb.Database) error {
if err := s.chainState.DeleteVerifiedBlock(blkID); err != nil {
return nil
}

if err := s.BlockState.DeleteBlock(blkID); err != nil {
return nil
}
}

if err := iter.Error(); err != nil {
Expand Down
4 changes: 4 additions & 0 deletions vms/proposervm/state/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/require"

"github.com/ava-labs/avalanchego/database"
"github.com/ava-labs/avalanchego/database/memdb"
"github.com/ava-labs/avalanchego/database/versiondb"
"github.com/ava-labs/avalanchego/ids"
Expand Down Expand Up @@ -125,6 +126,9 @@ func TestPruneVerifiedBlocksOnRestart(t *testing.T) {
ok, err := state.HasVerifiedBlock(blk.ID())
require.NoError(err)
require.False(ok)

_, _, err = state.GetBlock(blk.ID())
require.ErrorIs(err, database.ErrNotFound)
}

for _, blk := range tt.preferredBlks {
Expand Down

0 comments on commit d529a1b

Please sign in to comment.