Skip to content

Commit

Permalink
reproduce ref root bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Nov 19, 2024
1 parent e64d157 commit 84283c7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions mutable_tree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1494,3 +1494,27 @@ func TestMutableTree_InitialVersionZero(t *testing.T) {
require.NoError(t, err)
require.Equal(t, int64(0), version)
}

func TestReferenceRootPruning(t *testing.T) {
memDB := dbm.NewMemDB()
tree := NewMutableTree(memDB, 0, true, NewNopLogger())

_, err := tree.Set([]byte("foo"), []byte("bar"))
require.NoError(t, err)
_, _, err = tree.SaveVersion()
require.NoError(t, err)

_, _, err = tree.SaveVersion()
require.NoError(t, err)

_, err = tree.Set([]byte("foo1"), []byte("bar"))
require.NoError(t, err)
_, _, err = tree.SaveVersion()
require.NoError(t, err)

err = tree.DeleteVersionsTo(1)
require.NoError(t, err)

_, err = tree.Set([]byte("foo"), []byte("bar*"))
require.NoError(t, err)
}

0 comments on commit 84283c7

Please sign in to comment.