Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nzpr committed Jul 10, 2021
1 parent 5ce1882 commit b6274f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Expand Up @@ -59,11 +59,15 @@ class LastFinalizedKeyValueStorage[F[_]: Sync] private (
_ <- Log[F].info("Migration of LFB done.")

// record finalized blocks
finalizedBlockSet = DagOps
.bfTraverse(List(lfb)) { bh =>
blocksInfoMap.get(bh).map(_.parents.toList).getOrElse(List.empty)
}
.toList
finalizedBlockSet <- DagOps
.bfTraverseF(List(lfb)) { bh =>
blocksInfoMap
.get(bh)
// with trimmed state edge parents might not be in the blockmetadataDB, so filter them out
.map(_.parents.toList.filterA(blockMetadataDb.contains(_)))
.getOrElse(List.empty[BlockHash].pure)
}
.toList

processChunk = (chunk: List[BlockHash]) => {
implicit val s = new Show[BlockHash] {
Expand Down
Expand Up @@ -246,9 +246,9 @@ class Initializing[F[_]
.map(_.latestBlockHash)
.toSet

// Add sorted DAG in order from oldest to approved block
// Add sorted DAG in order from approved block to oldest
minHeight <- getMinBlockHeight
_ <- heightMap.flatMap(_._2).toList.traverse_ { hash =>
_ <- heightMap.flatMap(_._2).toList.reverse.traverse_ { hash =>
for {
block <- BlockStore[F].getUnsafe(hash)
// If sender has stake 0 in approved block, this means that sender has been slashed and block is invalid
Expand Down

0 comments on commit b6274f8

Please sign in to comment.