File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
main/scala/io/iohk/ethereum/blockchain/sync/fast
test/scala/io/iohk/ethereum/db/dataSource Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -823,8 +823,8 @@ class FastSync(
823
823
val bestReceivedBlock = fullBlocks.maxBy(_.number)
824
824
val lastStoredBestBlockNumber = appStateStorage.getBestBlockNumber()
825
825
if (lastStoredBestBlockNumber < bestReceivedBlock.number) {
826
- blockchain.saveBestKnownBlocks(bestReceivedBlock.number)
827
826
appStateStorage.putBestBlockNumber(bestReceivedBlock.number).commit()
827
+ blockchain.saveBestKnownBlocks(bestReceivedBlock.number)
828
828
}
829
829
syncState = syncState.copy(lastFullBlockNumber = bestReceivedBlock.number.max(lastStoredBestBlockNumber))
830
830
}
Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ package io.iohk.ethereum.db.dataSource
2
2
3
3
import java .io .File
4
4
import java .nio .file .Files
5
-
6
5
import io .iohk .ethereum .ObjectGenerators
7
6
import io .iohk .ethereum .db .dataSource .DataSource .{Key , Namespace , Value }
7
+ import io .iohk .ethereum .db .dataSource .RocksDbDataSource .RocksDbDataSourceClosedException
8
8
import org .scalatest .flatspec .AnyFlatSpec
9
9
import org .scalatestplus .scalacheck .ScalaCheckPropertyChecks
10
10
@@ -48,6 +48,15 @@ trait DataSourceTestBehavior extends ScalaCheckPropertyChecks with ObjectGenerat
48
48
}
49
49
}
50
50
51
+ it should " throw an exception if the rocksdb storage is unavailable" in {
52
+ withDir { path =>
53
+ val dataSource = createDataSource(path)
54
+ val someByteString = byteStringOfLengthNGen(KeySizeWithoutPrefix ).sample.get
55
+ dataSource.destroy()
56
+ assertThrows[RocksDbDataSourceClosedException ](dataSource.update(prepareUpdate(toUpsert = Seq (someByteString -> someByteString))))
57
+ }
58
+ }
59
+
51
60
it should " allow to remove keys" in {
52
61
val key1 = byteStringOfLengthNGen(KeySizeWithoutPrefix ).sample.get
53
62
val key2 = byteStringOfLengthNGen(KeySizeWithoutPrefix ).sample.get
@@ -111,5 +120,4 @@ trait DataSourceTestBehavior extends ScalaCheckPropertyChecks with ObjectGenerat
111
120
}
112
121
}
113
122
// scalastyle:on
114
-
115
123
}
You can’t perform that action at this time.
0 commit comments