From 27bc2d3e87b9cdee2eed48512234581ea867cd71 Mon Sep 17 00:00:00 2001 From: Alexander Chepurnoy Date: Thu, 30 May 2024 01:08:54 +0300 Subject: [PATCH] scaladoc fixes --- .../mining/CandidateGenerator.scala | 12 ++++----- .../org/ergoplatform/mining/ErgoMiner.scala | 16 ++++++------ .../nodeView/history/ErgoHistoryReader.scala | 6 ++--- .../nodeView/history/extra/IndexedToken.scala | 2 +- .../nodeView/history/extra/Segment.scala | 4 +-- .../nodeView/state/DigestState.scala | 2 +- .../nodeView/state/UtxoState.scala | 26 +++++++++---------- .../nodeView/wallet/ErgoWalletActor.scala | 8 +++--- 8 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/main/scala/org/ergoplatform/mining/CandidateGenerator.scala b/src/main/scala/org/ergoplatform/mining/CandidateGenerator.scala index a42b50e6db..06d22db34b 100644 --- a/src/main/scala/org/ergoplatform/mining/CandidateGenerator.scala +++ b/src/main/scala/org/ergoplatform/mining/CandidateGenerator.scala @@ -74,7 +74,7 @@ class CandidateGenerator( override def receive: Receive = { - /** first we need to get Readers to have some initial state to work with */ + // first we need to get Readers to have some initial state to work with case Readers(h, s: UtxoStateReader, m, _) => val lastHeaders = h.lastHeaders(500).headers val avgMiningTime = getBlockMiningTimeAvg(lastHeaders.map(_.timestamp)) @@ -118,10 +118,10 @@ class CandidateGenerator( case _: NodeViewChange => // Just ignore all other NodeView Changes - /** - * When new block is applied, either one mined by us or received from peers isn't equal to our candidate's parent, - * we need to generate new candidate and possibly also discard existing solution if it is also behind - */ + /* + * When new block is applied, either one mined by us or received from peers isn't equal to our candidate's parent, + * we need to generate new candidate and possibly also discard existing solution if it is also behind + */ case FullBlockApplied(header) => log.info( s"Preparing new candidate on getting new block at ${header.height}" @@ -884,7 +884,7 @@ object CandidateGenerator extends ScorexLogging { } /** - * Derives header without pow from [[CandidateBlock]]. + * Derives header without pow from a block candidate provided */ def deriveUnprovenHeader(candidate: CandidateBlock): HeaderWithoutPow = { val (parentId, height) = derivedHeaderFields(candidate.parentOpt) diff --git a/src/main/scala/org/ergoplatform/mining/ErgoMiner.scala b/src/main/scala/org/ergoplatform/mining/ErgoMiner.scala index 82b8630abd..9eec7a24c2 100644 --- a/src/main/scala/org/ergoplatform/mining/ErgoMiner.scala +++ b/src/main/scala/org/ergoplatform/mining/ErgoMiner.scala @@ -68,7 +68,7 @@ class ErgoMiner( override def receive: Receive = { - /** at first keep trying to obtain secret and public key as we cannot mine without it */ + // at first keep trying to obtain secret and public key as we cannot mine without it case walletQuery: WalletQuery => viewHolderRef ! GetDataFromCurrentView[DigestState, Unit] { v => walletQuery match { @@ -143,13 +143,13 @@ class ErgoMiner( case ReadMinerPk => // used in /mining/rewardAddress API method sender() ! StatusReply.success(minerState.publicKey) - /** - * Non obvious but case when mining is enabled, but miner isn't started yet. Initialization case. - * We've received block that been generated by somebody else or genesis while we doesn't start. - * And this block was generated after our miner had been started. That means that we are ready - * to start mining. - * This block could be either genesis or generated by another node. - */ + /* + * Non obvious but case when mining is enabled, but miner isn't started yet. Initialization case. + * We've received block that been generated by somebody else or genesis while we doesn't start. + * And this block was generated after our miner had been started. That means that we are ready + * to start mining. + * This block could be either genesis or generated by another node. + */ case FullBlockApplied(header) if shouldStartMine(header) => log.info("Starting mining triggered by incoming block") diff --git a/src/main/scala/org/ergoplatform/nodeView/history/ErgoHistoryReader.scala b/src/main/scala/org/ergoplatform/nodeView/history/ErgoHistoryReader.scala index 3fde451134..9f7a45f0fe 100644 --- a/src/main/scala/org/ergoplatform/nodeView/history/ErgoHistoryReader.scala +++ b/src/main/scala/org/ergoplatform/nodeView/history/ErgoHistoryReader.scala @@ -361,9 +361,9 @@ trait ErgoHistoryReader * @return */ def syncInfoV1: ErgoSyncInfoV1 = { - /** - * Return last count headers from best headers chain if exist or chain up to genesis otherwise - */ + /* + * Return last count headers from best headers chain if exist or chain up to genesis otherwise + */ def lastHeaderIds(count: Int): IndexedSeq[ModifierId] = { val currentHeight = headersHeight val from = Math.max(currentHeight - count + 1, 1) diff --git a/src/main/scala/org/ergoplatform/nodeView/history/extra/IndexedToken.scala b/src/main/scala/org/ergoplatform/nodeView/history/extra/IndexedToken.scala index e29b0fc04d..a6449f4027 100644 --- a/src/main/scala/org/ergoplatform/nodeView/history/extra/IndexedToken.scala +++ b/src/main/scala/org/ergoplatform/nodeView/history/extra/IndexedToken.scala @@ -167,7 +167,7 @@ object IndexedToken { * so they are checked with Try-catches. * * @param iEb - box to use - * @param tokenIndex - token index to check in [[ErgoBox.additionalTokens]] + * @param tokenIndex - token index to check in box' `additionalTokens` * @return token index */ def fromBox(iEb: IndexedErgoBox, tokenIndex: Int): IndexedToken = { diff --git a/src/main/scala/org/ergoplatform/nodeView/history/extra/Segment.scala b/src/main/scala/org/ergoplatform/nodeView/history/extra/Segment.scala index c45a5c9595..572f2043c1 100644 --- a/src/main/scala/org/ergoplatform/nodeView/history/extra/Segment.scala +++ b/src/main/scala/org/ergoplatform/nodeView/history/extra/Segment.scala @@ -244,7 +244,7 @@ abstract class Segment[T <: Segment[_] : ClassTag](val parentId: ModifierId, * @param mempool - mempool to use, if unconfirmed is true * @param offset - items to skip from the start * @param limit - items to retrieve - * @param sortDir - whether to start retreival from newest box ([[DESC]]) or oldest box ([[ASC]]) + * @param sortDir - whether to start retrieval from newest box (DESC) or oldest box (ASC) * @param unconfirmed - whether to include unconfirmed boxes * @return array of unspent boxes */ @@ -288,7 +288,7 @@ abstract class Segment[T <: Segment[_] : ClassTag](val parentId: ModifierId, } /** - * Logic for [[Segment.rollback]] + * Logic for `Segment.rollback` * * @param txTarget - remove transaction numbers above this number * @param boxTarget - remove box numbers above this number diff --git a/src/main/scala/org/ergoplatform/nodeView/state/DigestState.scala b/src/main/scala/org/ergoplatform/nodeView/state/DigestState.scala index 3c5a3a4721..94a51540b7 100644 --- a/src/main/scala/org/ergoplatform/nodeView/state/DigestState.scala +++ b/src/main/scala/org/ergoplatform/nodeView/state/DigestState.scala @@ -154,7 +154,7 @@ class DigestState protected(override val version: VersionTag, object DigestState extends ScorexLogging with ScorexEncoding { /** - * Creates [[DigestState]] from existing [[ErgoStateContext]] corresponding to some `version` and `rootHash`. + * Creates [[DigestState]] with provided `ErgoStateContext` instance corresponding to some version` and `rootHash`. */ def recover(version: VersionTag, rootHash: ADDigest, diff --git a/src/main/scala/org/ergoplatform/nodeView/state/UtxoState.scala b/src/main/scala/org/ergoplatform/nodeView/state/UtxoState.scala index 01b98a59ef..a16f29265b 100644 --- a/src/main/scala/org/ergoplatform/nodeView/state/UtxoState.scala +++ b/src/main/scala/org/ergoplatform/nodeView/state/UtxoState.scala @@ -159,19 +159,19 @@ class UtxoState(override val persistentProver: PersistentBatchAVLProver[Digest32 log.error("Calculated proofHash is not equal to the declared one, doing another attempt") - /** - * Proof generated was different from one announced. - * - * In most cases, announced proof is okay, and as proof is already checked, problem in some - * extra bytes added to the proof. - * - * Could be related to https://github.com/ergoplatform/ergo/issues/1614 - * - * So the problem could appear on mining nodes only, and caused by - * proofsForTransactions() wasting the tree unexpectedly. - * - * We are trying to generate proof again now. - */ + /* + * Proof generated was different from one announced. + * + * In most cases, announced proof is okay, and as proof is already checked, problem in some + * extra bytes added to the proof. + * + * Could be related to https://github.com/ergoplatform/ergo/issues/1614 + * + * So the problem could appear on mining nodes only, and caused by + * proofsForTransactions() wasting the tree unexpectedly. + * + * We are trying to generate proof again now. + */ persistentProver.rollback(inRoot) .ensuring(java.util.Arrays.equals(persistentProver.digest, inRoot)) diff --git a/src/main/scala/org/ergoplatform/nodeView/wallet/ErgoWalletActor.scala b/src/main/scala/org/ergoplatform/nodeView/wallet/ErgoWalletActor.scala index c65599f212..b64b43522f 100644 --- a/src/main/scala/org/ergoplatform/nodeView/wallet/ErgoWalletActor.scala +++ b/src/main/scala/org/ergoplatform/nodeView/wallet/ErgoWalletActor.scala @@ -116,7 +116,7 @@ class ErgoWalletActor(settings: ErgoSettings, case _: RestoreWallet | _: InitWallet => sender() ! Failure(new Exception("Wallet is already initialized or testMnemonic is set. Clear current secret to re-init it.")) - /** READERS */ + /* READERS */ case ReadBalances(chainStatus) => val walletDigest = if (chainStatus.onChain) { state.registry.fetchDigest() @@ -194,7 +194,7 @@ class ErgoWalletActor(settings: ErgoSettings, case ReadScans => sender() ! ReadScansResponse(state.walletVars.externalScans) - /** STATE CHANGE */ + /* STATE CHANGE */ case ChangedMempool(mr: ErgoMemPoolReader@unchecked) => val newState = ergoWalletService.updateUtxoState(state.copy(mempoolReaderOpt = Some(mr))) context.become(loadedWallet(newState)) @@ -219,7 +219,7 @@ class ErgoWalletActor(settings: ErgoSettings, context.become(loadedWallet(state.copy(error = Some(errorMsg)))) } - /** SCAN COMMANDS */ + /* SCAN COMMANDS */ //scan mempool transaction case ScanOffChain(tx) => val dustLimit = settings.walletSettings.dustLimit @@ -300,7 +300,7 @@ class ErgoWalletActor(settings: ErgoSettings, log.warn("Avoiding rollback as wallet is not initialized yet") } - /** WALLET COMMANDS */ + /* WALLET COMMANDS */ case CheckSeed(mnemonic, passOpt) => state.secretStorageOpt match { case Some(secretStorage) =>