diff --git a/storage/pebble.go b/storage/pebble.go index f6f37a8b..3ae7fe83 100644 --- a/storage/pebble.go +++ b/storage/pebble.go @@ -261,17 +261,12 @@ type PebbleTxIter struct { func (pi *PebbleTxIter) Next() bool { for { if !pi.init { - pi.init = true if !pi.i.First() { return false } - } - - if !pi.i.Valid() { - return false - } - if !pi.i.Next() { + pi.init = true + } else if !pi.i.Next() { return false } diff --git a/storage/pebble_test.go b/storage/pebble_test.go index eb26a686..bc054a1a 100644 --- a/storage/pebble_test.go +++ b/storage/pebble_test.go @@ -145,7 +145,7 @@ func TestStorageIters(t *testing.T) { txCount++ } - require.Equal(t, 2, txCount) + require.Equal(t, 3, txCount) defer require.NoError(t, it.Close())