diff --git a/server/app/com/xsn/explorer/processors/BlockEventsProcessor.scala b/server/app/com/xsn/explorer/processors/BlockEventsProcessor.scala index 406a0a4..cf1032e 100644 --- a/server/app/com/xsn/explorer/processors/BlockEventsProcessor.scala +++ b/server/app/com/xsn/explorer/processors/BlockEventsProcessor.scala @@ -117,7 +117,7 @@ class BlockEventsProcessor @Inject() ( .createBlock(newBlock, newTransactions) .map { case Good(BlockOps.Result.BlockCreated) => Good(MissingBlockProcessed(newBlock)) - case Good(BlockOps.Result.BlockReplacedByHeight) => Good(ReplacedByBlockHeight) + case Good(BlockOps.Result.BlockReplacedByHeight) => Good(ReplacedByBlockHeight(newBlock)) case Bad(errors) => Bad(errors) } @@ -171,5 +171,5 @@ object BlockEventsProcessor { case class NewBlockAppended(block: Block) extends Result case class RechainDone(orphanBlock: Block, newBlock: Block) extends Result case object MissingBlockIgnored extends Result - case object ReplacedByBlockHeight extends Result + case class ReplacedByBlockHeight(newBlock: Block) extends Result } \ No newline at end of file diff --git a/server/app/com/xsn/explorer/tasks/PollingSeederTask.scala b/server/app/com/xsn/explorer/tasks/PollingSeederTask.scala index 1606bdb..f0cd338 100644 --- a/server/app/com/xsn/explorer/tasks/PollingSeederTask.scala +++ b/server/app/com/xsn/explorer/tasks/PollingSeederTask.scala @@ -56,6 +56,9 @@ class PollingSeederTask @Inject() ( case BlockEventsProcessor.MissingBlockProcessed(block) => backwardsSynchronizerTask.sync(block) + case BlockEventsProcessor.ReplacedByBlockHeight(newBlock) => + backwardsSynchronizerTask.sync(newBlock) + case _ => () } } diff --git a/server/app/com/xsn/explorer/tasks/SQSSeederTask.scala b/server/app/com/xsn/explorer/tasks/SQSSeederTask.scala index 28d16d6..461007f 100644 --- a/server/app/com/xsn/explorer/tasks/SQSSeederTask.scala +++ b/server/app/com/xsn/explorer/tasks/SQSSeederTask.scala @@ -106,6 +106,7 @@ class SQSSeederTask @Inject() ( backwardsSynchronizerTask.sync(block) case BlockEventsProcessor.MissingBlockIgnored => () - case BlockEventsProcessor.ReplacedByBlockHeight => () + case BlockEventsProcessor.ReplacedByBlockHeight(newBlock) => + backwardsSynchronizerTask.sync(newBlock) } } diff --git a/server/test/com/xsn/explorer/processors/BlockEventsProcessorSpec.scala b/server/test/com/xsn/explorer/processors/BlockEventsProcessorSpec.scala index 8514629..4ab1e45 100644 --- a/server/test/com/xsn/explorer/processors/BlockEventsProcessorSpec.scala +++ b/server/test/com/xsn/explorer/processors/BlockEventsProcessorSpec.scala @@ -261,7 +261,7 @@ class BlockEventsProcessorSpec extends PostgresDataHandlerSpec with ScalaFutures .foreach { whenReady(_) { _.isGood mustEqual true } } whenReady(processor.processBlock(block3.hash)) { result => - result mustEqual Good(ReplacedByBlockHeight) + result mustEqual Good(ReplacedByBlockHeight(block3)) val blocks = List(block1.copy(nextBlockhash = Some(block3.hash)), block3) verifyBlockchain(blocks)