Skip to content

Commit

Permalink
floating
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Mar 4, 2024
1 parent 83812a9 commit 79bdda4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
17 changes: 17 additions & 0 deletions api/spec/v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,12 @@ components:
format: int32
description: Number of transactions in the block.
example: 17
proposer:
allOf: [$ref: '#/components/schemas/NodeInfo']
signers:
type: array
items:
allOf: [$ref: '#/components/schemas/NodeInfo']
# TODO: Not available on backend
# size:
# type: integer
Expand All @@ -1371,6 +1377,17 @@ components:
description: |
A consensus block.
NodeInfo:
type: object
properties:
node_id:
type: string
entity_id:
type: string
entity_address:
type: string
entity_metadata: {}

Delegation:
type: object
required: [amount, shares, validator, delegator]
Expand Down
19 changes: 12 additions & 7 deletions storage/client/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@ const (
WHERE layer=$1`

Blocks = `
SELECT height, block_hash, time, num_txs
FROM chain.blocks
WHERE ($1::bigint IS NULL OR height >= $1::bigint) AND
($2::bigint IS NULL OR height <= $2::bigint) AND
($3::timestamptz IS NULL OR time >= $3::timestamptz) AND
($4::timestamptz IS NULL OR time < $4::timestamptz) AND
($5::text IS NULL OR block_hash = $5::text)
SELECT
height,
block_hash,
time,
num_txs
FROM chain.blocks
WHERE
($1::bigint IS NULL OR height >= $1::bigint) AND
($2::bigint IS NULL OR height <= $2::bigint) AND
($3::timestamptz IS NULL OR time >= $3::timestamptz) AND
($4::timestamptz IS NULL OR time < $4::timestamptz) AND
($5::text IS NULL OR block_hash = $5::text)
ORDER BY height DESC
LIMIT $6::bigint
OFFSET $7::bigint`
Expand Down

0 comments on commit 79bdda4

Please sign in to comment.