From 2dd9b4837a115382bd78637e03ba9eee60bb9527 Mon Sep 17 00:00:00 2001 From: Alexis Hernandez Date: Sat, 16 Feb 2019 22:36:00 -0700 Subject: [PATCH] server: Update the data package to use the Block from the persisted package --- .../xsn/explorer/data/BlockDataHandler.scala | 2 +- .../xsn/explorer/data/LedgerDataHandler.scala | 2 +- .../data/anorm/BlockPostgresDataHandler.scala | 2 +- .../anorm/LedgerPostgresDataHandler.scala | 2 +- .../data/anorm/dao/BlockPostgresDAO.scala | 2 +- .../data/anorm/parsers/BlockParsers.scala | 6 ++--- .../data/async/BlockFutureDataHandler.scala | 2 +- .../data/async/LedgerFutureDataHandler.scala | 2 +- .../services/LedgerSynchronizerService.scala | 8 +++--- .../data/BlockPostgresDataHandlerSpec.scala | 2 +- .../data/LedgerPostgresDataHandlerSpec.scala | 22 ++------------- .../TransactionPostgresDataHandlerSpec.scala | 14 +++------- .../xsn/explorer/helpers/BlockLoader.scala | 27 +++++++++++++------ .../com/xsn/explorer/helpers/Converters.scala | 13 +++++++++ .../helpers/FileBasedXSNService.scala | 2 +- .../xsn/explorer/helpers/LedgerHelper.scala | 24 +++++++++++++++++ .../LedgerSynchronizerServiceSpec.scala | 11 +------- .../controllers/BlocksControllerSpec.scala | 14 +++++----- 18 files changed, 86 insertions(+), 71 deletions(-) create mode 100644 server/test/com/xsn/explorer/helpers/Converters.scala create mode 100644 server/test/com/xsn/explorer/helpers/LedgerHelper.scala diff --git a/server/app/com/xsn/explorer/data/BlockDataHandler.scala b/server/app/com/xsn/explorer/data/BlockDataHandler.scala index ae25552..fd3d7b9 100644 --- a/server/app/com/xsn/explorer/data/BlockDataHandler.scala +++ b/server/app/com/xsn/explorer/data/BlockDataHandler.scala @@ -4,7 +4,7 @@ import com.alexitc.playsonify.core.ApplicationResult import com.alexitc.playsonify.models.ordering.FieldOrdering import com.alexitc.playsonify.models.pagination.{PaginatedQuery, PaginatedResult} import com.xsn.explorer.models.fields.BlockField -import com.xsn.explorer.models.rpc.Block +import com.xsn.explorer.models.persisted.Block import com.xsn.explorer.models.{Blockhash, Height} import scala.language.higherKinds diff --git a/server/app/com/xsn/explorer/data/LedgerDataHandler.scala b/server/app/com/xsn/explorer/data/LedgerDataHandler.scala index 1ef6c29..fa793da 100644 --- a/server/app/com/xsn/explorer/data/LedgerDataHandler.scala +++ b/server/app/com/xsn/explorer/data/LedgerDataHandler.scala @@ -2,7 +2,7 @@ package com.xsn.explorer.data import com.alexitc.playsonify.core.ApplicationResult import com.xsn.explorer.models.Transaction -import com.xsn.explorer.models.rpc.Block +import com.xsn.explorer.models.persisted.Block import scala.language.higherKinds diff --git a/server/app/com/xsn/explorer/data/anorm/BlockPostgresDataHandler.scala b/server/app/com/xsn/explorer/data/anorm/BlockPostgresDataHandler.scala index 425ecbd..fc6570f 100644 --- a/server/app/com/xsn/explorer/data/anorm/BlockPostgresDataHandler.scala +++ b/server/app/com/xsn/explorer/data/anorm/BlockPostgresDataHandler.scala @@ -7,7 +7,7 @@ import com.xsn.explorer.data.BlockBlockingDataHandler import com.xsn.explorer.data.anorm.dao.BlockPostgresDAO import com.xsn.explorer.errors._ import com.xsn.explorer.models.fields.BlockField -import com.xsn.explorer.models.rpc.Block +import com.xsn.explorer.models.persisted.Block import com.xsn.explorer.models.{Blockhash, Height} import javax.inject.Inject import org.scalactic.{Good, One, Or} diff --git a/server/app/com/xsn/explorer/data/anorm/LedgerPostgresDataHandler.scala b/server/app/com/xsn/explorer/data/anorm/LedgerPostgresDataHandler.scala index 1a74f8a..3549565 100644 --- a/server/app/com/xsn/explorer/data/anorm/LedgerPostgresDataHandler.scala +++ b/server/app/com/xsn/explorer/data/anorm/LedgerPostgresDataHandler.scala @@ -7,7 +7,7 @@ import com.alexitc.playsonify.models.ApplicationError import com.xsn.explorer.data.LedgerBlockingDataHandler import com.xsn.explorer.data.anorm.dao.{AggregatedAmountPostgresDAO, BalancePostgresDAO, BlockPostgresDAO, TransactionPostgresDAO} import com.xsn.explorer.errors.{PostgresForeignKeyViolationError, PreviousBlockMissingError, RepeatedBlockHeightError} -import com.xsn.explorer.models.rpc.Block +import com.xsn.explorer.models.persisted.Block import com.xsn.explorer.models.{Address, Balance, Transaction} import com.xsn.explorer.util.Extensions.ListOptionExt import javax.inject.Inject diff --git a/server/app/com/xsn/explorer/data/anorm/dao/BlockPostgresDAO.scala b/server/app/com/xsn/explorer/data/anorm/dao/BlockPostgresDAO.scala index 335755f..1ec0fa6 100644 --- a/server/app/com/xsn/explorer/data/anorm/dao/BlockPostgresDAO.scala +++ b/server/app/com/xsn/explorer/data/anorm/dao/BlockPostgresDAO.scala @@ -8,7 +8,7 @@ import com.alexitc.playsonify.models.pagination.{Count, Limit, Offset, Paginated import com.alexitc.playsonify.sql.FieldOrderingSQLInterpreter import com.xsn.explorer.data.anorm.parsers.BlockParsers._ import com.xsn.explorer.models.fields.BlockField -import com.xsn.explorer.models.rpc.Block +import com.xsn.explorer.models.persisted.Block import com.xsn.explorer.models.{Blockhash, Height} import javax.inject.Inject diff --git a/server/app/com/xsn/explorer/data/anorm/parsers/BlockParsers.scala b/server/app/com/xsn/explorer/data/anorm/parsers/BlockParsers.scala index de1cf37..cc0fb63 100644 --- a/server/app/com/xsn/explorer/data/anorm/parsers/BlockParsers.scala +++ b/server/app/com/xsn/explorer/data/anorm/parsers/BlockParsers.scala @@ -3,7 +3,7 @@ package com.xsn.explorer.data.anorm.parsers import anorm.SqlParser._ import anorm._ import com.xsn.explorer.models._ -import com.xsn.explorer.models.rpc.Block +import com.xsn.explorer.models.persisted.Block object BlockParsers { @@ -79,9 +79,7 @@ object BlockParsers { bits = bits, chainwork = chainwork, difficulty = difficulty, - version = version, - transactions = List.empty, - confirmations = Confirmations(0) + version = version ) } } diff --git a/server/app/com/xsn/explorer/data/async/BlockFutureDataHandler.scala b/server/app/com/xsn/explorer/data/async/BlockFutureDataHandler.scala index dc2e45a..cd450c1 100644 --- a/server/app/com/xsn/explorer/data/async/BlockFutureDataHandler.scala +++ b/server/app/com/xsn/explorer/data/async/BlockFutureDataHandler.scala @@ -6,7 +6,7 @@ import com.alexitc.playsonify.models.pagination.PaginatedQuery import com.xsn.explorer.data.{BlockBlockingDataHandler, BlockDataHandler} import com.xsn.explorer.executors.DatabaseExecutionContext import com.xsn.explorer.models.fields.BlockField -import com.xsn.explorer.models.rpc.Block +import com.xsn.explorer.models.persisted.Block import com.xsn.explorer.models.{Blockhash, Height} import javax.inject.Inject diff --git a/server/app/com/xsn/explorer/data/async/LedgerFutureDataHandler.scala b/server/app/com/xsn/explorer/data/async/LedgerFutureDataHandler.scala index 3407298..4a6b6e7 100644 --- a/server/app/com/xsn/explorer/data/async/LedgerFutureDataHandler.scala +++ b/server/app/com/xsn/explorer/data/async/LedgerFutureDataHandler.scala @@ -6,7 +6,7 @@ import com.alexitc.playsonify.core.FutureApplicationResult import com.xsn.explorer.data.{LedgerBlockingDataHandler, LedgerDataHandler} import com.xsn.explorer.executors.DatabaseExecutionContext import com.xsn.explorer.models.Transaction -import com.xsn.explorer.models.rpc.Block +import com.xsn.explorer.models.persisted.Block import scala.concurrent.Future diff --git a/server/app/com/xsn/explorer/services/LedgerSynchronizerService.scala b/server/app/com/xsn/explorer/services/LedgerSynchronizerService.scala index 019f431..c757b41 100644 --- a/server/app/com/xsn/explorer/services/LedgerSynchronizerService.scala +++ b/server/app/com/xsn/explorer/services/LedgerSynchronizerService.scala @@ -4,9 +4,10 @@ import com.alexitc.playsonify.core.FutureApplicationResult import com.alexitc.playsonify.core.FutureOr.Implicits.{FutureOps, OptionOps} import com.xsn.explorer.data.async.{BlockFutureDataHandler, LedgerFutureDataHandler} import com.xsn.explorer.errors.BlockNotFoundError -import com.xsn.explorer.models.rpc.Block +import com.xsn.explorer.models.persisted.Block import com.xsn.explorer.models.{Blockhash, Height, Transaction} import com.xsn.explorer.util.Extensions.FutureOrExt +import io.scalaland.chimney.dsl._ import javax.inject.Inject import org.scalactic.Good import org.slf4j.LoggerFactory @@ -159,8 +160,9 @@ class LedgerSynchronizerService @Inject() ( private def getRPCBlock(blockhash: Blockhash): FutureApplicationResult[(Block, List[Transaction])] = { val result = for { - block <- xsnService.getBlock(blockhash).toFutureOr - transactions <- transactionRPCService.getTransactions(block.transactions).toFutureOr + rpcBlock <- xsnService.getBlock(blockhash).toFutureOr + transactions <- transactionRPCService.getTransactions(rpcBlock.transactions).toFutureOr + block = rpcBlock.into[Block].transform } yield (block, transactions) result.toFuture diff --git a/server/test/com/xsn/explorer/data/BlockPostgresDataHandlerSpec.scala b/server/test/com/xsn/explorer/data/BlockPostgresDataHandlerSpec.scala index 43ebdec..a7c0911 100644 --- a/server/test/com/xsn/explorer/data/BlockPostgresDataHandlerSpec.scala +++ b/server/test/com/xsn/explorer/data/BlockPostgresDataHandlerSpec.scala @@ -10,7 +10,7 @@ import com.xsn.explorer.errors.BlockNotFoundError import com.xsn.explorer.helpers.BlockLoader import com.xsn.explorer.models.Blockhash import com.xsn.explorer.models.fields.BlockField -import com.xsn.explorer.models.rpc.Block +import com.xsn.explorer.models.persisted.Block import org.scalactic.{Bad, One, Or} import org.scalatest.BeforeAndAfter diff --git a/server/test/com/xsn/explorer/data/LedgerPostgresDataHandlerSpec.scala b/server/test/com/xsn/explorer/data/LedgerPostgresDataHandlerSpec.scala index e52273e..a33e407 100644 --- a/server/test/com/xsn/explorer/data/LedgerPostgresDataHandlerSpec.scala +++ b/server/test/com/xsn/explorer/data/LedgerPostgresDataHandlerSpec.scala @@ -2,10 +2,9 @@ package com.xsn.explorer.data import com.xsn.explorer.data.common.PostgresDataHandlerSpec import com.xsn.explorer.errors.{PreviousBlockMissingError, RepeatedBlockHeightError} +import com.xsn.explorer.helpers.Converters._ import com.xsn.explorer.helpers.DataHandlerObjects._ -import com.xsn.explorer.helpers.{BlockLoader, TransactionLoader} -import com.xsn.explorer.models.Transaction -import com.xsn.explorer.models.rpc.Block +import com.xsn.explorer.helpers.LedgerHelper._ import org.scalactic.{Bad, Good} import org.scalatest.BeforeAndAfter @@ -13,15 +12,6 @@ class LedgerPostgresDataHandlerSpec extends PostgresDataHandlerSpec with BeforeA lazy val dataHandler = createLedgerDataHandler(database) - val blockList = List( - BlockLoader.get("00000c822abdbb23e28f79a49d29b41429737c6c7e15df40d1b1f1b35907ae34"), - BlockLoader.get("000003fb382f6892ae96594b81aa916a8923c70701de4e7054aac556c7271ef7"), - BlockLoader.get("000004645e2717b556682e3c642a4c6e473bf25c653ff8e8c114a3006040ffb8"), - BlockLoader.get("00000766115b26ecbc09cd3a3db6870fdaf2f049d65a910eb2f2b48b566ca7bd"), - BlockLoader.get("00000b59875e80b0afc6c657bc5318d39e03532b7d97fb78a4c7bd55c4840c32"), - BlockLoader.get("00000267225f7dba55d9a3493740e7f0dde0f28a371d2c3b42e7676b5728d020") - ) - before { clearDatabase() } @@ -80,12 +70,4 @@ class LedgerPostgresDataHandlerSpec extends PostgresDataHandlerSpec with BeforeA } } } - - private def getTransactions(block: Block) = { - block - .transactions - .map(_.string) - .map(TransactionLoader.get) - .map(Transaction.fromRPC) - } } diff --git a/server/test/com/xsn/explorer/data/TransactionPostgresDataHandlerSpec.scala b/server/test/com/xsn/explorer/data/TransactionPostgresDataHandlerSpec.scala index 9393dff..36bf5ef 100644 --- a/server/test/com/xsn/explorer/data/TransactionPostgresDataHandlerSpec.scala +++ b/server/test/com/xsn/explorer/data/TransactionPostgresDataHandlerSpec.scala @@ -4,9 +4,10 @@ import com.alexitc.playsonify.models.ordering.{FieldOrdering, OrderingCondition} import com.alexitc.playsonify.models.pagination._ import com.xsn.explorer.data.common.PostgresDataHandlerSpec import com.xsn.explorer.errors.{BlockNotFoundError, TransactionNotFoundError} +import com.xsn.explorer.helpers.Converters._ import com.xsn.explorer.helpers.DataHandlerObjects._ import com.xsn.explorer.helpers.DataHelper._ -import com.xsn.explorer.helpers.{BlockLoader, DataGenerator, TransactionLoader} +import com.xsn.explorer.helpers.{DataGenerator, LedgerHelper, TransactionLoader} import com.xsn.explorer.models._ import com.xsn.explorer.models.fields.TransactionField import com.xsn.explorer.models.rpc.Block @@ -23,16 +24,9 @@ class TransactionPostgresDataHandlerSpec extends PostgresDataHandlerSpec with Be val defaultOrdering = FieldOrdering(TransactionField.Time, OrderingCondition.DescendingOrder) - val block = DataGenerator.randomBlock() + val blockList = LedgerHelper.blockList.take(6) - val blockList = List( - BlockLoader.get("00000c822abdbb23e28f79a49d29b41429737c6c7e15df40d1b1f1b35907ae34"), - BlockLoader.get("000003fb382f6892ae96594b81aa916a8923c70701de4e7054aac556c7271ef7"), - BlockLoader.get("000004645e2717b556682e3c642a4c6e473bf25c653ff8e8c114a3006040ffb8"), - BlockLoader.get("00000766115b26ecbc09cd3a3db6870fdaf2f049d65a910eb2f2b48b566ca7bd"), - BlockLoader.get("00000b59875e80b0afc6c657bc5318d39e03532b7d97fb78a4c7bd55c4840c32"), - BlockLoader.get("00000267225f7dba55d9a3493740e7f0dde0f28a371d2c3b42e7676b5728d020") - ) + val block = DataGenerator.randomBlock() val dummyTransaction = randomTransaction(blockhash = block.hash, utxos = List.empty) diff --git a/server/test/com/xsn/explorer/helpers/BlockLoader.scala b/server/test/com/xsn/explorer/helpers/BlockLoader.scala index 9ff63c3..a32b6cd 100644 --- a/server/test/com/xsn/explorer/helpers/BlockLoader.scala +++ b/server/test/com/xsn/explorer/helpers/BlockLoader.scala @@ -2,17 +2,23 @@ package com.xsn.explorer.helpers import java.io.File -import com.xsn.explorer.models.rpc.Block -import com.xsn.explorer.models.{Blockhash, rpc} +import com.xsn.explorer.models._ +import io.scalaland.chimney.dsl._ import play.api.libs.json.{JsValue, Json} object BlockLoader { private val BasePath = "blocks" - def get(blockhash: String): Block = { - val block = json(blockhash).as[Block] - cleanGenesisBlock(block) + def get(blockhash: String): persisted.Block = { + val rpcBlock = getRPC(blockhash) + + rpcBlock.into[persisted.Block].transform + } + + def getRPC(blockhash: String): rpc.Block = { + val partial = json(blockhash).as[rpc.Block] + cleanGenesisBlock(partial) } def json(blockhash: String): JsValue = { @@ -21,17 +27,22 @@ object BlockLoader { val json = scala.io.Source.fromResource(resource).getLines().mkString("\n") Json.parse(json) } catch { - case _ => throw new RuntimeException(s"Block $blockhash not found") + case _: Throwable => throw new RuntimeException(s"Block $blockhash not found") } } - def all(): List[Block] = { + def all(): List[persisted.Block] = { + allRPC() + .map(_.into[persisted.Block].transform) + } + + def allRPC(): List[rpc.Block] = { val uri = getClass.getResource(s"/$BasePath") new File(uri.getPath) .listFiles() .toList .map(_.getName) - .map(get) + .map(getRPC) } def cleanGenesisBlock(block: rpc.Block): rpc.Block = { diff --git a/server/test/com/xsn/explorer/helpers/Converters.scala b/server/test/com/xsn/explorer/helpers/Converters.scala new file mode 100644 index 0000000..021ae48 --- /dev/null +++ b/server/test/com/xsn/explorer/helpers/Converters.scala @@ -0,0 +1,13 @@ +package com.xsn.explorer.helpers + +import com.xsn.explorer.models._ +import io.scalaland.chimney.dsl._ + +import scala.language.implicitConversions + +object Converters { + + implicit def toPersistedBlock(rpcBlock: rpc.Block): persisted.Block = { + rpcBlock.into[persisted.Block].transform + } +} diff --git a/server/test/com/xsn/explorer/helpers/FileBasedXSNService.scala b/server/test/com/xsn/explorer/helpers/FileBasedXSNService.scala index 736d6f0..246ae03 100644 --- a/server/test/com/xsn/explorer/helpers/FileBasedXSNService.scala +++ b/server/test/com/xsn/explorer/helpers/FileBasedXSNService.scala @@ -11,7 +11,7 @@ import scala.concurrent.Future class FileBasedXSNService extends DummyXSNService { - private lazy val blockMap = BlockLoader.all().map { block => block.hash -> block }.toMap + private lazy val blockMap = BlockLoader.allRPC().map { block => block.hash -> block }.toMap private lazy val transactionMap = TransactionLoader.all().map { tx => tx.id -> tx }.toMap override def getBlock(blockhash: Blockhash): FutureApplicationResult[Block] = { diff --git a/server/test/com/xsn/explorer/helpers/LedgerHelper.scala b/server/test/com/xsn/explorer/helpers/LedgerHelper.scala new file mode 100644 index 0000000..a1bda21 --- /dev/null +++ b/server/test/com/xsn/explorer/helpers/LedgerHelper.scala @@ -0,0 +1,24 @@ +package com.xsn.explorer.helpers + +import com.xsn.explorer.models._ + +object LedgerHelper { + + val blockList = List( + BlockLoader.getRPC("00000c822abdbb23e28f79a49d29b41429737c6c7e15df40d1b1f1b35907ae34"), + BlockLoader.getRPC("000003fb382f6892ae96594b81aa916a8923c70701de4e7054aac556c7271ef7"), + BlockLoader.getRPC("000004645e2717b556682e3c642a4c6e473bf25c653ff8e8c114a3006040ffb8"), + BlockLoader.getRPC("00000766115b26ecbc09cd3a3db6870fdaf2f049d65a910eb2f2b48b566ca7bd"), + BlockLoader.getRPC("00000b59875e80b0afc6c657bc5318d39e03532b7d97fb78a4c7bd55c4840c32"), + BlockLoader.getRPC("00000267225f7dba55d9a3493740e7f0dde0f28a371d2c3b42e7676b5728d020"), + BlockLoader.getRPC("0000017ee4121cd8ae22f7321041ccb953d53828824217a9dc61a1c857facf85") + ) + + def getTransactions(block: rpc.Block): List[Transaction] = { + block + .transactions + .map(_.string) + .map(TransactionLoader.get) + .map(Transaction.fromRPC) + } +} diff --git a/server/test/com/xsn/explorer/services/LedgerSynchronizerServiceSpec.scala b/server/test/com/xsn/explorer/services/LedgerSynchronizerServiceSpec.scala index 19199b0..98237a0 100644 --- a/server/test/com/xsn/explorer/services/LedgerSynchronizerServiceSpec.scala +++ b/server/test/com/xsn/explorer/services/LedgerSynchronizerServiceSpec.scala @@ -6,6 +6,7 @@ import com.xsn.explorer.data.async.{BlockFutureDataHandler, LedgerFutureDataHand import com.xsn.explorer.data.common.PostgresDataHandlerSpec import com.xsn.explorer.errors.BlockNotFoundError import com.xsn.explorer.helpers.DataHandlerObjects._ +import com.xsn.explorer.helpers.LedgerHelper._ import com.xsn.explorer.helpers._ import com.xsn.explorer.models.rpc.Block import com.xsn.explorer.models.{Blockhash, Height} @@ -22,16 +23,6 @@ class LedgerSynchronizerServiceSpec extends PostgresDataHandlerSpec with BeforeA lazy val transactionDataHandler = createTransactionDataHandler(database) lazy val blockDataHandler = createBlockDataHandler(database) - val blockList = List( - BlockLoader.get("00000c822abdbb23e28f79a49d29b41429737c6c7e15df40d1b1f1b35907ae34"), - BlockLoader.get("000003fb382f6892ae96594b81aa916a8923c70701de4e7054aac556c7271ef7"), - BlockLoader.get("000004645e2717b556682e3c642a4c6e473bf25c653ff8e8c114a3006040ffb8"), - BlockLoader.get("00000766115b26ecbc09cd3a3db6870fdaf2f049d65a910eb2f2b48b566ca7bd"), - BlockLoader.get("00000b59875e80b0afc6c657bc5318d39e03532b7d97fb78a4c7bd55c4840c32"), - BlockLoader.get("00000267225f7dba55d9a3493740e7f0dde0f28a371d2c3b42e7676b5728d020"), - BlockLoader.get("0000017ee4121cd8ae22f7321041ccb953d53828824217a9dc61a1c857facf85") - ) - val genesis = blockList(0) before { diff --git a/server/test/controllers/BlocksControllerSpec.scala b/server/test/controllers/BlocksControllerSpec.scala index 24ad8e8..d53de0f 100644 --- a/server/test/controllers/BlocksControllerSpec.scala +++ b/server/test/controllers/BlocksControllerSpec.scala @@ -19,7 +19,7 @@ import play.api.test.Helpers._ class BlocksControllerSpec extends MyAPISpec { // PoS block - val posBlock = BlockLoader.get("1ca318b7a26ed67ca7c8c9b5069d653ba224bf86989125d1dfbb0973b7d6a5e0") + val posBlock = BlockLoader.getRPC("1ca318b7a26ed67ca7c8c9b5069d653ba224bf86989125d1dfbb0973b7d6a5e0") val customXSNService = new FileBasedXSNService @@ -27,7 +27,7 @@ class BlocksControllerSpec extends MyAPISpec { // TODO: Handle ordering override def getByBlockhash(blockhash: Blockhash, paginatedQuery: PaginatedQuery, ordering: FieldOrdering[TransactionField]): ApplicationResult[PaginatedResult[TransactionWithValues]] = { val transactions = BlockLoader - .get(blockhash.string) + .getRPC(blockhash.string) .transactions .map(_.string) .map(TransactionLoader.get) @@ -82,7 +82,7 @@ class BlocksControllerSpec extends MyAPISpec { } "retrieve a PoS block having a rounding error" in { - val posBlockRoundingError = BlockLoader.get("25762bf01143f7fe34912c926e0b95528b082c6323de35516de0fc321f5d8058") + val posBlockRoundingError = BlockLoader.getRPC("25762bf01143f7fe34912c926e0b95528b082c6323de35516de0fc321f5d8058") val block = posBlockRoundingError val response = GET(url(block.hash.string)) @@ -103,7 +103,7 @@ class BlocksControllerSpec extends MyAPISpec { } "retrieve a PoW block" in { - val powBlock = BlockLoader.get("000004645e2717b556682e3c642a4c6e473bf25c653ff8e8c114a3006040ffb8") + val powBlock = BlockLoader.getRPC("000004645e2717b556682e3c642a4c6e473bf25c653ff8e8c114a3006040ffb8") val block = powBlock val response = GET(url(block.hash.string)) @@ -121,7 +121,7 @@ class BlocksControllerSpec extends MyAPISpec { } "retrieve TPoS block" in { - val tposBlock = BlockLoader.get("19f320185015d146237efe757852b21c5e08b88b2f4de9d3fa9517d8463e472b") + val tposBlock = BlockLoader.getRPC("19f320185015d146237efe757852b21c5e08b88b2f4de9d3fa9517d8463e472b") val block = tposBlock val response = GET(url(block.hash.string)) @@ -147,7 +147,7 @@ class BlocksControllerSpec extends MyAPISpec { } "retrieve TPoS block with coinsplit" in { - val tposBlock2 = BlockLoader.get("a3a9fb111a3f85c3d920c2dc58ce14d541a65763834247ef958aa3b4d665ef9c") + val tposBlock2 = BlockLoader.getRPC("a3a9fb111a3f85c3d920c2dc58ce14d541a65763834247ef958aa3b4d665ef9c") val block = tposBlock2 val response = GET(url(block.hash.string)) @@ -173,7 +173,7 @@ class BlocksControllerSpec extends MyAPISpec { } "retrieve the genesis block" in { - val block = BlockLoader.get("00000c822abdbb23e28f79a49d29b41429737c6c7e15df40d1b1f1b35907ae34") + val block = BlockLoader.getRPC("00000c822abdbb23e28f79a49d29b41429737c6c7e15df40d1b1f1b35907ae34") val response = GET(url(block.hash.string)) status(response) mustEqual OK