Skip to content

Commit

Permalink
Merge 676e6b9 into 6599f24
Browse files Browse the repository at this point in the history
  • Loading branch information
redroy44 committed Jun 11, 2021
2 parents 6599f24 + 676e6b9 commit 7c44534
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
visible: true
data-type: "hash"
}
nTx {
n_tx {
visible: true
}
previous_block_hash {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MetadataService(

private val entities = {
def futureEntities(path: NetworkPath): List[Entity] =
Await.result(platformDiscoveryOperations.getEntities(path), 5 second)
Await.result(platformDiscoveryOperations.getEntities(path), 10 second)

networks.values.flatten
.map(_.path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class GenericPlatformDiscoveryOperations(
updatedEntities <- IO.fromFuture(
IO(dbRunner.runQuery(preCacheEntities(networkPath.up.platform, networkPath.network)))
)
_ <- caching.putAllEntities(updatedEntities)
_ <- caching.putEntities(key, updatedEntities(key).value)
} yield ()).unsafeRunAsyncAndForget()
IO.pure(ent)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ class GenericPlatformDiscoveryOperationsTest
Attribute("weight", "Weight", DataType.Int, None, KeyType.NonKey, "transactions"),
Attribute("hash", "Hash", DataType.String, None, KeyType.NonKey, "transactions"),
Attribute("hex", "Hex", DataType.String, None, KeyType.NonKey, "transactions"),
Attribute("version", "Version", DataType.Int, None, KeyType.NonKey, "transactions"),
Attribute("version", "Version", DataType.LargeInt, None, KeyType.NonKey, "transactions"),
Attribute("block_hash", "Block hash", DataType.String, None, KeyType.NonKey, "transactions"),
Attribute("size", "Size", DataType.Int, None, KeyType.NonKey, "transactions"),
Attribute("vsize", "Vsize", DataType.Int, None, KeyType.NonKey, "transactions"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ class BitcoinPersistence[F[_]: Concurrent] {
def createBlock(
block: Block,
transactions: List[Transaction]
): DBIOAction[Unit, NoStream, Effect.Write] =
): DBIOAction[Unit, NoStream, Effect.Write] = {
import tech.cryptonomic.conseil.common.sql.CustomProfileExtension.api._
DBIO.seq(
Tables.Blocks += block.convertTo[Tables.BlocksRow],
Tables.Transactions ++= transactions.map(t => (t, block)).map(_.convertTo[Tables.TransactionsRow]),
// txid can be duplicated https://github.com/bitcoin/bitcoin/issues/612
Tables.Transactions.insertOrUpdateAll(transactions.map(t => (t, block)).map(_.convertTo[Tables.TransactionsRow])),
Tables.Inputs ++= transactions.flatMap(t => t.vin.map(c => (t, c, block))).map(_.convertTo[Tables.InputsRow]),
Tables.Outputs ++= transactions.flatMap(t => t.vout.map(c => (t, c, block))).map(_.convertTo[Tables.OutputsRow])
)
}

/**
* Get sequence of existing blocks heights from the database.
Expand Down Expand Up @@ -97,7 +100,7 @@ object BitcoinPersistence {
case (transaction, block) =>
Tables.TransactionsRow(
txid = transaction.txid,
blockHash = transaction.blockhash,
blockHash = block.hash,
blockLevel = block.height,
hash = transaction.hash,
hex = transaction.hex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ trait Tables {
* @param size Database column size SqlType(int4)
* @param vsize Database column vsize SqlType(int4)
* @param weight Database column weight SqlType(int4)
* @param version Database column version SqlType(int4)
* @param version Database column version SqlType(int8)
* @param lockTime Database column lock_time SqlType(timestamp)
* @param blockTime Database column block_time SqlType(timestamp) */
case class TransactionsRow(
Expand All @@ -535,7 +535,7 @@ trait Tables {
size: Int,
vsize: Int,
weight: Int,
version: Int,
version: Long,
lockTime: java.sql.Timestamp,
blockTime: java.sql.Timestamp
)
Expand All @@ -544,7 +544,8 @@ trait Tables {
implicit def GetResultTransactionsRow(
implicit e0: GR[String],
e1: GR[Int],
e2: GR[java.sql.Timestamp]
e2: GR[Long],
e3: GR[java.sql.Timestamp]
): GR[TransactionsRow] = GR { prs =>
import prs._
TransactionsRow.tupled(
Expand All @@ -557,7 +558,7 @@ trait Tables {
<<[Int],
<<[Int],
<<[Int],
<<[Int],
<<[Long],
<<[java.sql.Timestamp],
<<[java.sql.Timestamp]
)
Expand Down Expand Up @@ -622,8 +623,8 @@ trait Tables {
/** Database column weight SqlType(int4) */
val weight: Rep[Int] = column[Int]("weight")

/** Database column version SqlType(int4) */
val version: Rep[Int] = column[Int]("version")
/** Database column version SqlType(int8) */
val version: Rep[Long] = column[Long]("version")

/** Database column lock_time SqlType(timestamp) */
val lockTime: Rep[java.sql.Timestamp] = column[java.sql.Timestamp]("lock_time")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ case class Transaction(
size: Int,
vsize: Int,
weight: Int,
version: Int,
time: Int,
version: Long,
time: Long,
locktime: Long,
blocktime: Int,
vin: Seq[TransactionInput],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ trait BitcoinFixtures {
size = 134,
vsize = 134,
weight = 536,
version = 1,
time = 1294691980,
version = 1L,
time = 1294691980L,
locktime = 0L,
blocktime = 1294691980,
vin = List(inputResult),
Expand Down Expand Up @@ -267,7 +267,7 @@ trait BitcoinFixtures {
size = 134,
vsize = 134,
weight = 536,
version = 1,
version = 1L,
lockTime = new Timestamp(0),
blockTime = Timestamp.from(Instant.parse("2011-01-10T20:39:40.00Z"))
)
Expand Down
12 changes: 12 additions & 0 deletions hasura/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@
- table:
schema: tezos
name: token_balances
- table:
schema: tezos
name: processed_chain_events
- table:
schema: tezos
name: accounts_checkpoint
- table:
schema: tezos
name: bakers_checkpoint
- table:
schema: tezos
name: forks
- table:
schema: bitcoin
name: blocks
Expand Down
2 changes: 1 addition & 1 deletion sql/conseil.sql
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ CREATE TABLE bitcoin.transactions (
size integer NOT NULL,
vsize integer NOT NULL,
weight integer NOT NULL,
version integer NOT NULL,
version bigint NOT NULL,
lock_time timestamp without time zone NOT NULL,
block_time timestamp without time zone NOT NULL
);
Expand Down

0 comments on commit 7c44534

Please sign in to comment.