Skip to content

Commit

Permalink
LocallyGeneratedSubBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
kushti committed Sep 13, 2024
1 parent fb98a2e commit 95fb95e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 95fb95e

Please sign in to comment.