diff --git a/src/main/scala/com/wavesplatform/Coordinator.scala b/src/main/scala/com/wavesplatform/Coordinator.scala index 9edd4b31e74..002829e95df 100644 --- a/src/main/scala/com/wavesplatform/Coordinator.scala +++ b/src/main/scala/com/wavesplatform/Coordinator.scala @@ -56,12 +56,12 @@ object Coordinator extends ScorexLogging with Instrumented { firstDeclined .foldLeft[Either[ValidationError, BigInt]](Right(history.score())) { case (_, (i, b, e)) if i == 0 => - log.warn(s"Can't process fork starting with $lastCommonBlockId, error appending block ${b.uniqueId}: $e") + log.warn(s"Can't process fork starting with $lastCommonBlockId, error appending block $b: $e") Left(e) case (r, (i, b, e)) => log.debug(s"Processed $i of ${newBlocks.size} blocks from extension") - log.warn(s"Can't process fork starting with $lastCommonBlockId, error appending block ${b.uniqueId}: $e") + log.warn(s"Can't process fork starting with $lastCommonBlockId, error appending block $b: $e") r } } @@ -150,7 +150,7 @@ object Coordinator extends ScorexLogging with Instrumented { featureProvider: FeatureProvider) (block: Block, local: Boolean): Either[ValidationError, Int] = for { _ <- Either.cond(checkpoint.isBlockValid(block.signerData.signature, history.height() + 1), (), - GenericError(s"Block ${block.uniqueId} at height ${history.height() + 1} is not valid w.r.t. checkpoint")) + GenericError(s"Block $block at height ${history.height() + 1} is not valid w.r.t. checkpoint")) _ <- blockConsensusValidation(history, featureProvider, settings, time.correctedTime(), block) { height => PoSCalc.generatingBalance(stateReader, settings.functionalitySettings, block.signerData.generator, height).toEither.left.map(_.toString) .flatMap(validateEffectiveBalance(featureProvider, settings.functionalitySettings, block, height)) @@ -188,7 +188,7 @@ object Coordinator extends ScorexLogging with Instrumented { val hh = existingItems.map(_.height) :+ genesisBlockHeight history.blockAt(hh(fork.size)).foreach { lastValidBlock => - log.warn(s"Fork detected (length = ${fork.size}), rollback to last valid block id [${lastValidBlock.uniqueId}]") + log.warn(s"Fork detected (length = ${fork.size}), rollback to last valid block $lastValidBlock]") blockBlockForkStats.increment() blockForkHeightStats.record(fork.size) blockchainUpdater.removeAfter(lastValidBlock.uniqueId) @@ -229,7 +229,7 @@ object Coordinator extends ScorexLogging with Instrumented { hit = calcHit(prevBlockData, generator) target = calcTarget(parent.consensusData.baseTarget, parent.timestamp, blockTime, effectiveBalance) _ <- Either.cond(hit < target, (), s"calculated hit $hit >= calculated target $target") - } yield ()).left.map(e => GenericError(s"Block ${block.uniqueId} is invalid: $e")) + } yield ()).left.map(e => GenericError(s"Block $block is invalid: $e")) } private val blockBlockForkStats = Kamon.metrics.counter("block-fork") diff --git a/src/main/scala/com/wavesplatform/history/HistoryWriterImpl.scala b/src/main/scala/com/wavesplatform/history/HistoryWriterImpl.scala index d7fa9f57262..0f5c9fb802a 100644 --- a/src/main/scala/com/wavesplatform/history/HistoryWriterImpl.scala +++ b/src/main/scala/com/wavesplatform/history/HistoryWriterImpl.scala @@ -78,7 +78,7 @@ class HistoryWriterImpl private(file: Option[File], val synchronizationToken: Re if (h % 100 == 0) db.compact(CompactFillRate, CompactMemorySize) - log.trace(s"Full Block(id=${block.uniqueId},txs_count=${block.transactionData.size}) persisted") + log.trace(s"Full Block $block(id=${block.uniqueId} persisted") blockDiff } else { diff --git a/src/main/scala/com/wavesplatform/network/CoordinatorHandler.scala b/src/main/scala/com/wavesplatform/network/CoordinatorHandler.scala index ea0e41b5807..712a002adc0 100644 --- a/src/main/scala/com/wavesplatform/network/CoordinatorHandler.scala +++ b/src/main/scala/com/wavesplatform/network/CoordinatorHandler.scala @@ -83,18 +83,18 @@ class CoordinatorHandler(checkpointService: CheckpointService, Signed.validateSignatures(b).flatMap(b => processBlock(b, false)) } map { case Right(None) => - log.trace(s"Block ${b.uniqueId} already appended") + log.trace(s"Block $b already appended") case Right(Some(newScore)) => - log.debug(s"Appended block ${b.uniqueId}") + log.debug(s"Appended block $b") if (b.transactionData.isEmpty) allChannels.broadcast(BlockForged(b), Some(ctx.channel())) miner.scheduleMining() allChannels.broadcast(LocalScoreChanged(newScore)) case Left(is: InvalidSignature) => - peerDatabase.blacklistAndClose(ctx.channel(), s"Could not append block ${b.uniqueId}: $is") + peerDatabase.blacklistAndClose(ctx.channel(), s"Could not append block $b: $is") case Left(ve) => BlockStats.declined(b, BlockStats.Source.Broadcast) - log.debug(s"Could not append block ${b.uniqueId}: $ve") + log.debug(s"Could not append block $b: $ve") }).onErrorHandle[Unit](ctx.fireExceptionCaught).runAsync case md: MicroblockData => diff --git a/src/main/scala/com/wavesplatform/network/ExtensionBlocksLoader.scala b/src/main/scala/com/wavesplatform/network/ExtensionBlocksLoader.scala index 0d4d40929ff..4036603725c 100644 --- a/src/main/scala/com/wavesplatform/network/ExtensionBlocksLoader.scala +++ b/src/main/scala/com/wavesplatform/network/ExtensionBlocksLoader.scala @@ -75,7 +75,7 @@ class ExtensionBlocksLoader( } else { newBlocks.par.find(!_.signatureValid) match { case Some(invalidBlock) => - peerDatabase.blacklistAndClose(ctx.channel(),s"Got block ${invalidBlock.uniqueId} with invalid signature") + peerDatabase.blacklistAndClose(ctx.channel(),s"Got block $invalidBlock with invalid signature") case None => log.trace(s"${id(ctx)} Chain is valid, pre-check passed") ctx.fireChannelRead(ExtensionBlocks(newBlocks)) diff --git a/src/main/scala/com/wavesplatform/network/messages.scala b/src/main/scala/com/wavesplatform/network/messages.scala index 186a184d8d3..3839b96d8e7 100644 --- a/src/main/scala/com/wavesplatform/network/messages.scala +++ b/src/main/scala/com/wavesplatform/network/messages.scala @@ -20,16 +20,14 @@ case class LocalScoreChanged(newLocalScore: History.BlockchainScore) extends Mes case class RawBytes(code: Byte, data: Array[Byte]) extends Message case class BlockForged(block: Block) extends Message case class MicroBlockRequest(totalBlockSig: ByteStr) extends Message -case class MicroBlockResponse(microblock: MicroBlock) extends Message { - override def toString: String = s"MicroBlockResponse(MicroBlock(${microblock.totalResBlockSig.trim}~>${microblock.prevResBlockSig.trim}))" -} +case class MicroBlockResponse(microblock: MicroBlock) extends Message case class LoadBlockchainExtension(lastBlockIds: Seq[ByteStr]) case class ExtensionIds(lastCommonId: ByteStr, extensionIds: Seq[ByteStr]) case class ExtensionBlocks(extension: Seq[Block]) case class MicroBlockInv(sender: PublicKeyAccount, totalBlockSig: ByteStr, prevBlockSig: ByteStr, signature: ByteStr) extends Message with Signed { override protected def signatureValid: Boolean = EllipticCurveImpl.verify(signature.arr, sender.toAddress.bytes.arr ++ totalBlockSig.arr ++ prevBlockSig.arr, sender.publicKey) - override def toString: String = s"MicroBlockInv(totalBlockSig=$totalBlockSig, prevBlockSig=${prevBlockSig.trim})" + override def toString: String = s"MicroBlockInv(totalBlockSig=${totalBlockSig.trim}, prevBlockSig=${prevBlockSig.trim})" } object MicroBlockInv{ diff --git a/src/main/scala/com/wavesplatform/state2/BlockchainUpdaterImpl.scala b/src/main/scala/com/wavesplatform/state2/BlockchainUpdaterImpl.scala index 4d5a514120d..d922bda197e 100644 --- a/src/main/scala/com/wavesplatform/state2/BlockchainUpdaterImpl.scala +++ b/src/main/scala/com/wavesplatform/state2/BlockchainUpdaterImpl.scala @@ -143,14 +143,14 @@ class BlockchainUpdaterImpl private(persisted: StateWriter with StateReader, } } else if (areVersionsOfSameBlock(block, ng.base)) { if (block.transactionData.size <= ng.transactions.size) { - log.trace(s"Existing liquid block is better than new one, discarding ${block.uniqueId}") + log.trace(s"Existing liquid block is better than new one, discarding $block") Right(None) } else { log.trace(s"New liquid block is better version of exsting, swapping") BlockDiffer.fromBlock(settings.blockchainSettings.functionalitySettings, featureProvider, currentPersistedBlocksState, historyWriter.lastBlock, block).map(d => Some((d, Seq.empty[Transaction]))) } } else { - Left(BlockAppendError(s"Competitor's liquid block(id=${block.uniqueId.trim} score=${block.blockScore}) is not better than existing(ng.base.id=${ng.base.uniqueId.trim} score=${ng.base.blockScore})", block)) + Left(BlockAppendError(s"Competitor's liquid block $block(score=${block.blockScore}) is not better than existing (ng.base ${ng.base}(score=${ng.base.blockScore}))", block)) } case Some(ng) if !ng.contains(block.reference) => Left(BlockAppendError(s"References incorrect or non-existing block", block)) @@ -180,7 +180,7 @@ class BlockchainUpdaterImpl private(persisted: StateWriter with StateReader, val height = historyWriter.height() + 1 ngState.set(Some(NgState(block, newBlockDiff, 0L, featuresApprovedWithBlock(block)))) historyReader.lastBlockId().foreach(lastBlockId.onNext) - log.info(s"Block ${block.uniqueId} -> ${block.reference.trim} appended. New height: $height, transactions: ${block.transactionData.size})") + log.info(s"Block $block appended. New height: $height, transactions: ${block.transactionData.size})") discacrded case None => Seq.empty }) diff --git a/src/main/scala/scorex/block/Block.scala b/src/main/scala/scorex/block/Block.scala index 22a1cd62122..7b203aef4db 100755 --- a/src/main/scala/scorex/block/Block.scala +++ b/src/main/scala/scorex/block/Block.scala @@ -100,7 +100,7 @@ case class Block(timestamp: Long, override lazy val signedDescendants: Seq[Signed] = transactionData override def toString: String = - s"Block(timestamp=$timestamp, version=$version, reference=$reference, signerData=$signerData, consensusData=$consensusData, transactions.size=${transactionData.size}, supportedFeaturesIds=$featureVotes) " + s"Block(${signerData.signature} -> ${reference.trim}, txs=${transactionData.size}, feratures=$featureVotes) " } diff --git a/src/main/scala/scorex/transaction/ValidationError.scala b/src/main/scala/scorex/transaction/ValidationError.scala index eedeb2ccbfa..597b3e8a170 100644 --- a/src/main/scala/scorex/transaction/ValidationError.scala +++ b/src/main/scala/scorex/transaction/ValidationError.scala @@ -28,9 +28,7 @@ object ValidationError { case class AliasNotExists(a: Alias) extends ValidationError case class OrderValidationError(order: Order, err: String) extends ValidationError case class Mistiming(err: String) extends ValidationError - case class BlockAppendError(err: String,b: Block) extends ValidationError { - override def toString: String = s"BlockAppendError($err, BlockId=${b.uniqueId}])" - } + case class BlockAppendError(err: String,b: Block) extends ValidationError case class MicroBlockAppendError(err: String, microBlock: MicroBlock) extends ValidationError { override def toString: String = s"MicroBlockAppendError($err, ${microBlock.totalResBlockSig} ~> ${microBlock.prevResBlockSig.trim}])" }