Skip to content

Commit

Permalink
fix: missing first elem in graphql tx iterator (#33)
Browse files Browse the repository at this point in the history
Thanks!
  • Loading branch information
n0izn0iz authored Apr 15, 2024
1 parent d48e8b1 commit f026544
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions storage/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion storage/pebble_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down

0 comments on commit f026544

Please sign in to comment.