From 95fb95ecc337bf6edc5bdbdcb9ab821e254bf5c0 Mon Sep 17 00:00:00 2001 From: Alexander Chepurnoy Date: Fri, 13 Sep 2024 09:28:44 +0300 Subject: [PATCH] LocallyGeneratedSubBlock --- .../nodeView/LocallyGeneratedModifier.scala | 2 +- .../org/ergoplatform/mining/CandidateGenerator.scala | 5 ----- .../ergoplatform/nodeView/ErgoNodeViewHolder.scala | 11 ++++++++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ergo-core/src/main/scala/org/ergoplatform/nodeView/LocallyGeneratedModifier.scala b/ergo-core/src/main/scala/org/ergoplatform/nodeView/LocallyGeneratedModifier.scala index 712a185d35..27db8ed56f 100644 --- a/ergo-core/src/main/scala/org/ergoplatform/nodeView/LocallyGeneratedModifier.scala +++ b/ergo-core/src/main/scala/org/ergoplatform/nodeView/LocallyGeneratedModifier.scala @@ -5,4 +5,4 @@ import org.ergoplatform.modifiers.BlockSection /** * Wrapper for locally generated block section */ -case class LocallyGeneratedModifier(pmod: BlockSection) +case class LocallyGeneratedModifier(blockSection: BlockSection) diff --git a/src/main/scala/org/ergoplatform/mining/CandidateGenerator.scala b/src/main/scala/org/ergoplatform/mining/CandidateGenerator.scala index a42b50e6db..c74f9c9ce4 100644 --- a/src/main/scala/org/ergoplatform/mining/CandidateGenerator.scala +++ b/src/main/scala/org/ergoplatform/mining/CandidateGenerator.scala @@ -410,10 +410,6 @@ object CandidateGenerator extends ScorexLogging { ergoSettings.votingTargets.softForkOption.getOrElse(0) == 1 } - //todo: remove after 5.0 soft-fork activation - log.debug(s"betterVersion: $betterVersion, forkVotingAllowed: $forkVotingAllowed, " + - s"forkOrdered: $forkOrdered, nextHeightCondition: $nextHeightCondition") - betterVersion && forkVotingAllowed && forkOrdered && @@ -427,7 +423,6 @@ object CandidateGenerator extends ScorexLogging { * @param history - blockchain reader (to extract parent) * @param proposedUpdate - votes for parameters update or/and soft-fork * @param state - UTXO set reader - * @param timeProvider - network time provider * @param poolTxs - memory pool transactions * @param emissionTxOpt - optional emission transaction * @param prioritizedTransactions - transactions which are going into the block in the first place diff --git a/src/main/scala/org/ergoplatform/nodeView/ErgoNodeViewHolder.scala b/src/main/scala/org/ergoplatform/nodeView/ErgoNodeViewHolder.scala index 9bc0973eb6..15b5c67e8c 100644 --- a/src/main/scala/org/ergoplatform/nodeView/ErgoNodeViewHolder.scala +++ b/src/main/scala/org/ergoplatform/nodeView/ErgoNodeViewHolder.scala @@ -25,6 +25,7 @@ import spire.syntax.all.cfor import java.io.File import org.ergoplatform.modifiers.history.extension.Extension +import org.ergoplatform.subblocks.SubBlockInfo import scala.annotation.tailrec import scala.collection.mutable @@ -229,7 +230,7 @@ abstract class ErgoNodeViewHolder[State <: ErgoState[State]](settings: ErgoSetti case (success@Success(updateInfo), modToApply) => if (updateInfo.failedMod.isEmpty) { val chainTipOpt = history.estimatedTip() - updateInfo.state.applyModifier(modToApply, chainTipOpt)(lm => pmodModify(lm.pmod, local = true)) match { + updateInfo.state.applyModifier(modToApply, chainTipOpt)(lm => pmodModify(lm.blockSection, local = true)) match { case Success(stateAfterApply) => history.reportModifierIsValid(modToApply).map { newHis => if (modToApply.modifierTypeId == ErgoFullBlock.modifierTypeId) { @@ -670,8 +671,8 @@ abstract class ErgoNodeViewHolder[State <: ErgoState[State]](settings: ErgoSetti protected def processLocallyGeneratedModifiers: Receive = { case lm: LocallyGeneratedModifier => - log.info(s"Got locally generated modifier ${lm.pmod.encodedId} of type ${lm.pmod.modifierTypeId}") - pmodModify(lm.pmod, local = true) + log.info(s"Got locally generated modifier ${lm.blockSection.encodedId} of type ${lm.blockSection.modifierTypeId}") + pmodModify(lm.blockSection, local = true) } protected def getCurrentInfo: Receive = { @@ -724,6 +725,10 @@ object ErgoNodeViewHolder { // Modifiers received from the remote peer with new elements in it case class ModifiersFromRemote(modifiers: Iterable[BlockSection]) + /** + * Wrapper for a locally generated sub-block submitted via API + */ + case class LocallyGeneratedSubBlock(sbi: SubBlockInfo) /** * Wrapper for a transaction submitted via API