Skip to content

Commit 0e33365

Browse files
committed
Fixing blocktree storage
1 parent 7efde7e commit 0e33365

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

scorex-basics/src/main/scala/scorex/block/Block.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ object Block extends ScorexLogging {
224224

225225
override val versionField: ByteBlockField = ByteBlockField("version", 1)
226226
override val transactionDataField: BlockField[TDT] = transactionModule.genesisData
227-
override val referenceField: BlockIdField = BlockIdField("reference", Array.fill(BlockIdLength)(0: Byte))
227+
override val referenceField: BlockIdField = BlockIdField("reference", Array.fill(BlockIdLength)(-1: Byte))
228228
override val consensusDataField: BlockField[CDT] = consensusModule.genesisData
229229
override val uniqueId: BlockId = Array.fill(BlockIdLength)(0: Byte)
230230

scorex-basics/src/main/scala/scorex/network/HistorySynchronizer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class HistorySynchronizer(application: Application) extends ViewSynchronizer wit
8989
val localScore = history.score()
9090
if (networkScore > localScore) {
9191
log.info(s"networkScore=$networkScore > localScore=$localScore")
92-
val lastIds = history.lastBlocks(100).map(_.uniqueId)
92+
val lastIds = history.lastBlockIds(100)
9393
val msg = Message(GetSignaturesSpec, Right(lastIds), None)
9494
networkControllerRef ! NetworkController.SendToNetwork(msg, SendToChosen(witnesses))
9595
gotoGettingExtension(networkScore, witnesses)

scorex-transaction/src/main/scala/scorex/transaction/state/database/blockchain/StoredBlockTree.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ class StoredBlockTree(dataFolderOpt: Option[String], MaxRollback: Int)
166166
case Success(v) =>
167167
Some(v)
168168
case Failure(e) =>
169-
log.debug("Enable readBlock for key: " + Base58.encode(key))
169+
log.debug("Unable readBlock for key: " + Base58.encode(key))
170170
None
171171
}
172172
}
173173

174174
private val blockStorage: BlockTreePersistence = dataFolderOpt match {
175175
case Some(dataFolder) =>
176176
new File(dataFolder).mkdirs()
177-
val file = new File(dataFolder + "blocktree.mapDB")
177+
val file = new File(dataFolder + "/blocktree.mapDB")
178178
val db = DBMaker.appendFileDB(file).fileMmapEnableIfSupported().closeOnJvmShutdown().checksumEnable().make()
179179
new MapDBBlockTreePersistence(db)
180180
case _ => new MapDBBlockTreePersistence(DBMaker.memoryDB().make())
@@ -242,7 +242,7 @@ class StoredBlockTree(dataFolderOpt: Option[String], MaxRollback: Int)
242242
case _ => acc
243243
}
244244
}
245-
loop(block, howMany)
245+
loop(block, howMany, Seq(block))
246246
}
247247

248248
override def lastBlocks(howMany: Int): Seq[Block] = {

src/test/resources/settings-local2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"p2p": {
3-
"fuzzingDelay": 1000,
43
"nodeName": "Node2",
54
"localOnly": true,
65
"bindAddress": "127.0.0.2",
@@ -23,6 +22,7 @@
2322
],
2423
"maxRollback": 100,
2524
"offlineGeneration": false,
25+
"history": "blocktree",
2626
"perma": {
2727
"treeDir": "/tmp/scorex/data2/tree/",
2828
"authDataStorage": "authDataStorage2.mapDB"

0 commit comments

Comments
 (0)