Skip to content

Commit

Permalink
Merge pull request #3377 from nzpr/disable-index-cache
Browse files Browse the repository at this point in the history
Disable block index caching on single parent
  • Loading branch information
nzpr committed Apr 13, 2021
2 parents 1f7ac83 + 5739a31 commit fbcffbc
Showing 1 changed file with 9 additions and 4 deletions.
Expand Up @@ -286,16 +286,21 @@ class MultiParentCasperImpl[F[_]: Sync: Concurrent: Log: Time: SafetyOracle: Las
_ <- EitherT.liftF(Span[F].mark("equivocation-validated"))
} yield status

Log[F].info(s"Validating block ${PrettyPrinter.buildString(b, short = true)}.") <*
runtimeManager.getBlockIndexCache
.get(
// if merging is enabled - populate block index cache while validating block
val populateBlockIndexCache =
if (casperShardConf.maxNumberOfParents > 1)
runtimeManager.getBlockIndexCache.get(
MergingVertex(
b.blockHash,
ProtoUtil.postStateHash(b),
ProtoUtil.preStateHash(b),
ProtoUtil.deploys(b).toSet
)
) >> validationStatus.value
)
else ().pure[F]

Log[F].info(s"Validating block ${PrettyPrinter.buildString(b, short = true)}.") *>
populateBlockIndexCache *> validationStatus.value
}

override def handleValidBlock(block: BlockMessage): F[BlockDagRepresentation[F]] =
Expand Down

0 comments on commit fbcffbc

Please sign in to comment.