@@ -72,7 +72,7 @@ class HistoryStorage(storage: LSMStore,
72
72
storage.update(version, Seq (), Seq (validityKey(b) -> ByteArrayWrapper (Array (status.code))))
73
73
}
74
74
75
- def update (b : HybridBlock , difficulty : Option [(BigInt , Long )], isBest : Boolean ) {
75
+ def update (b : HybridBlock , difficulty : Option [(BigInt , BigInt )], isBest : Boolean ) {
76
76
log.debug(s " Write new best= $isBest block ${b.encodedId}" )
77
77
val typeByte = b match {
78
78
case _ : PowBlock =>
@@ -86,7 +86,7 @@ class HistoryStorage(storage: LSMStore,
86
86
87
87
val blockDiff : Iterable [(ByteArrayWrapper , ByteArrayWrapper )] = difficulty.map { d =>
88
88
Seq (blockDiffKey(b.id, isPos = false ) -> ByteArrayWrapper (d._1.toByteArray),
89
- blockDiffKey(b.id, isPos = true ) -> ByteArrayWrapper (Longs .toByteArray( d._2) ))
89
+ blockDiffKey(b.id, isPos = true ) -> ByteArrayWrapper (d._2.toByteArray ))
90
90
}.getOrElse(Seq ())
91
91
92
92
val bestBlockSeq : Iterable [(ByteArrayWrapper , ByteArrayWrapper )] = b match {
@@ -119,10 +119,10 @@ class HistoryStorage(storage: LSMStore,
119
119
}
120
120
}
121
121
122
- def getPoSDifficulty (id : ModifierId ): Long = if (id sameElements settings.GenesisParentId ) {
122
+ def getPoSDifficulty (id : ModifierId ): BigInt = if (id sameElements settings.GenesisParentId ) {
123
123
PosForger .InitialDifficuly
124
124
} else {
125
- Longs .fromByteArray (storage.get(blockDiffKey(id, isPos = true )).get.data)
125
+ BigInt (storage.get(blockDiffKey(id, isPos = true )).get.data)
126
126
}
127
127
128
128
def parentHeight (b : HybridBlock ): Long = heightOf(parentId(b)).getOrElse(0L )
0 commit comments