Skip to content

Commit

Permalink
Key should be re-calculate via value for node data source. #8
Browse files Browse the repository at this point in the history
  • Loading branch information
dcaoyuan committed Sep 21, 2019
1 parent c3e1152 commit 803da16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import khipu.DataWord
import khipu.config.DbConfig
import khipu.config.KhipuConfig
import khipu.config.RocksdbConfig
import khipu.crypto
import khipu.domain.Account
import khipu.rlp
import khipu.storage.datasource.KesqueBlockDataSource
Expand Down Expand Up @@ -137,11 +138,12 @@ object KesqueNodeCompactor {

def flush() {
val kvs = buf map {
case TKeyVal(key, value, offset) =>
case TKeyVal(_, value, offset) =>
_maxOffset = math.max(_maxOffset, offset)
val key = crypto.kec256(value)
Hash(key) -> value
}
//nodeDataSource.update(Nil, kvs)
nodeDataSource.update(Nil, kvs)

buf.clear()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ final class KesqueNodeDataSource(
var records = Vector[SimpleRecord]()
toUpsert foreach {
case kv @ (key, value) =>
val keyBytes = key.bytes
val record = new SimpleRecord(null, value)
if (firstTimestamp == Long.MinValue) {
firstTimestamp = 0
Expand Down

0 comments on commit 803da16

Please sign in to comment.