Skip to content

Commit

Permalink
core/state/snapshot, ethdb/rocksdb: Fixed RocksDB Iterator error.
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-wjhan committed May 28, 2024
1 parent 79ed58b commit 0a08255
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions core/state/snapshot/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,7 @@ func generateAccounts(ctx *generatorContext, dl *diskLayer, accMarker []byte) er
// If the iterated account is the contract, create a further loop to
// verify or regenerate the contract storage.
if acc.Root == emptyRoot {
log.Debug("removeStorageAt skip for rocksdb")
// ctx.removeStorageAt(account)
ctx.removeStorageAt(account)
} else {
var storeMarker []byte
if accMarker != nil && bytes.Equal(account[:], accMarker) && len(dl.genMarker) > common.HashLength {
Expand Down
5 changes: 5 additions & 0 deletions ethdb/rocksdb/rocksdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ func (it *RDBIterator) Next() bool {
if it.first {
it.first = false
} else {
// Added conditions to prevent Rocksdb Iterator error.
// Valid() call is a RocksDB requirement.
if C.rocksdb_iter_valid(it.it) == 0 {
return false
}
C.rocksdb_iter_next(it.it)
}
return C.rocksdb_iter_valid(it.it) != 0
Expand Down

0 comments on commit 0a08255

Please sign in to comment.