diff --git a/node/src/main/scala/com/wavesplatform/Application.scala b/node/src/main/scala/com/wavesplatform/Application.scala index 5c413c887f..1e3d6ff7ff 100644 --- a/node/src/main/scala/com/wavesplatform/Application.scala +++ b/node/src/main/scala/com/wavesplatform/Application.scala @@ -199,7 +199,6 @@ class Application(val actorSystem: ActorSystem, val settings: WavesSettings, con utxStorage.resetPriorityPool() blockchainUpdater.removeAfter(blockId) }.executeOn(appenderScheduler) - .asyncBoundary .map { case Right(discardedBlocks) => allChannels.broadcast(LocalScoreChanged(blockchainUpdater.score)) diff --git a/node/src/main/scala/com/wavesplatform/mining/Miner.scala b/node/src/main/scala/com/wavesplatform/mining/Miner.scala index 49b26beda0..f44c584117 100644 --- a/node/src/main/scala/com/wavesplatform/mining/Miner.scala +++ b/node/src/main/scala/com/wavesplatform/mining/Miner.scala @@ -279,8 +279,11 @@ class MinerImpl( case Right(Applied(_, score)) => log.debug(s"Forged and applied $block with cumulative score $score") BlockStats.mined(block, blockchainUpdater.height) - allChannels.broadcast(BlockForged(block)) - if (ngEnabled && !totalConstraint.isFull) startMicroBlockMining(account, block, totalConstraint) + + if (blockchainUpdater.isLastBlockId(block.id())) { + allChannels.broadcast(BlockForged(block)) + if (ngEnabled && !totalConstraint.isFull) startMicroBlockMining(account, block, totalConstraint) + } Task.unit case Right(Ignored) => diff --git a/node/src/main/scala/com/wavesplatform/state/appender/BlockAppender.scala b/node/src/main/scala/com/wavesplatform/state/appender/BlockAppender.scala index a8dc2104f6..39256a28cc 100644 --- a/node/src/main/scala/com/wavesplatform/state/appender/BlockAppender.scala +++ b/node/src/main/scala/com/wavesplatform/state/appender/BlockAppender.scala @@ -65,7 +65,7 @@ object BlockAppender extends ScorexLogging { validApplication <- EitherT(apply(blockchainUpdater, time, utxStorage, pos, scheduler)(newBlock)) } yield validApplication).value - val handle = append.asyncBoundary.map { + val handle = append.map { case Right(Ignored) => // block already appended case Right(Applied(_, _)) => log.debug(s"${id(ch)} Appended $newBlock") @@ -73,7 +73,8 @@ object BlockAppender extends ScorexLogging { span.markNtp("block.applied") span.finishNtp() BlockStats.applied(newBlock, BlockStats.Source.Broadcast, blockchainUpdater.height) - if (newBlock.transactionData.isEmpty) allChannels.broadcast(BlockForged(newBlock), Some(ch)) // Key block + if (blockchainUpdater.isLastBlockId(newBlock.id()) && newBlock.transactionData.isEmpty) + allChannels.broadcast(BlockForged(newBlock), Some(ch)) // Key block case Left(is: InvalidSignature) => peerDatabase.blacklistAndClose(ch, s"Could not append $newBlock: $is")