Skip to content

Commit

Permalink
Merge pull request #36 from Concordium/expand-block-api
Browse files Browse the repository at this point in the history
Query by block height directly
  • Loading branch information
limemloh authored May 17, 2023
2 parents b09e484 + 33f6c81 commit 74cb8df
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

## Unreleased changes

- Expand `BlockHashInput` to support querying by block height.
- Add `protocol_version` to the return of BlockInfo.
16 changes: 16 additions & 0 deletions v2/concordium/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,27 @@ message AccountInfo {

// Input to queries which take a block as a parameter.
message BlockHashInput {
// Request using a relative block height.
message RelativeHeight {
// Genesis index to start from.
GenesisIndex genesis_index = 1;
// Height starting from the genesis block at the genesis index.
BlockHeight height = 2;
// Whether to return results only from the specified genesis index (`true`),
// or allow results from more recent genesis indices as well (`false`).
bool restrict = 3;
}
oneof block_hash_input {
// Query for the best block.
Empty best = 1;
// Query for the last finalized block.
Empty last_final = 2;
// Query for the block specified by the hash. This hash should always be 32 bytes.
BlockHash given = 3;
// Query for a block at absolute height, if a unique block can be identified at that height.
AbsoluteBlockHeight absolute_height = 4;
// Query for a block at height relative to a genesis index.
RelativeHeight relative_height = 5;
}
}

Expand Down Expand Up @@ -1986,6 +2000,8 @@ message BlockInfo {
uint32 transactions_size = 15;
// The hash of the block state after this block.
StateHash state_hash = 16;
// Protocol version to which the block belongs.
ProtocolVersion protocol_version = 17;
}

// Request for GetPoolInfo.
Expand Down

0 comments on commit 74cb8df

Please sign in to comment.