Skip to content

Commit

Permalink
Simplified deploys creation
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislavlyalin committed Aug 19, 2022
1 parent e0a4d3a commit 777c541
Showing 1 changed file with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -192,24 +192,18 @@ object Proposer {
(future.pure ||^ expired.pure ||^ replayAttack).not
}
.map(_.map(_._1))
deploys <- {
val dummy = dummyDeployOpt
.traverse {
case (privateKey, term) =>
val deployData = ConstructDeploy.sourceDeployNow(
source = term,
sec = privateKey,
vabn = nextBlockNum - 1,
shardId = shardId
)
BlockDagStorage[F].addDeploy(deployData).as(List(deployData.sig))
}
OptionT
.fromOption(pooledOk.nonEmpty.guard[Option].as(pooledOk))
.orElseF(dummy)
.value
.map(_.getOrElse(List()))
}
deploys <- for {
dummy <- dummyDeployOpt.traverse {
case (privateKey, term) =>
val deployData = ConstructDeploy.sourceDeployNow(
source = term,
sec = privateKey,
vabn = nextBlockNum - 1,
shardId = shardId
)
BlockDagStorage[F].addDeploy(deployData).as(List(deployData.sig))
}
} yield Option(pooledOk).filter(_.nonEmpty).orElse(dummy).getOrElse(List.empty)
// create block
_ <- Log[F].info(s"Creating block #${nextBlockNum} (seqNum ${nextSeqNum})")
result <- BlockCreator(validatorIdentity, shardId).create(

0 comments on commit 777c541

Please sign in to comment.