Add query.GetRecentBlocks
This commit is contained in:
parent
9cf9fb061b
commit
d775b43e96
@ -25,6 +25,11 @@ service Query {
|
|||||||
* 查询帐本中的所有区块数量,或时间范围内的区块数量
|
* 查询帐本中的所有区块数量,或时间范围内的区块数量
|
||||||
*/
|
*/
|
||||||
rpc CountBlocks (BlocksRequest) returns (CountBlocksResponse);
|
rpc CountBlocks (BlocksRequest) returns (CountBlocksResponse);
|
||||||
|
/**
|
||||||
|
* Get recent 'count' blocks (Only support IncludeTransactions=NONE for now)
|
||||||
|
* 查询最新的n个区块
|
||||||
|
*/
|
||||||
|
rpc GetRecentBlocks (RecentBlocksRequest) returns (GetBlocksResponse);
|
||||||
/**
|
/**
|
||||||
* Get a transaction identified by its hash
|
* Get a transaction identified by its hash
|
||||||
* 查询哈希所指定的事务
|
* 查询哈希所指定的事务
|
||||||
@ -48,6 +53,12 @@ service Query {
|
|||||||
rpc CountTransactions (TransactionsRequest) returns (CountTransactionsResponse);
|
rpc CountTransactions (TransactionsRequest) returns (CountTransactionsResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum IncludeTransactions {
|
||||||
|
NONE = 0; // 不包含交易数据
|
||||||
|
HASH = 1; // 包含交易哈希列表
|
||||||
|
FULL = 2; // 包含完整交易列表
|
||||||
|
}
|
||||||
|
|
||||||
message BlockFilter {
|
message BlockFilter {
|
||||||
bytes hash = 1;
|
bytes hash = 1;
|
||||||
int64 timestamp = 2;
|
int64 timestamp = 2;
|
||||||
@ -75,11 +86,6 @@ message BlocksRequest {
|
|||||||
int64 start_timestamp = 2;
|
int64 start_timestamp = 2;
|
||||||
int64 end_timestamp = 3;
|
int64 end_timestamp = 3;
|
||||||
repeated BlockFilter filters = 4;
|
repeated BlockFilter filters = 4;
|
||||||
enum IncludeTransactions {
|
|
||||||
NONE = 0; // 不包含交易数据
|
|
||||||
HASH = 1; // 包含交易哈希列表
|
|
||||||
FULL = 2; // 包含完整交易列表
|
|
||||||
}
|
|
||||||
IncludeTransactions include_transactions = 5;
|
IncludeTransactions include_transactions = 5;
|
||||||
}
|
}
|
||||||
message GetBlocksResponse {
|
message GetBlocksResponse {
|
||||||
@ -93,6 +99,12 @@ message CountBlocksResponse {
|
|||||||
int64 end_timestamp = 3;
|
int64 end_timestamp = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message RecentBlocksRequest {
|
||||||
|
string ledger = 1;
|
||||||
|
int64 count = 2;
|
||||||
|
IncludeTransactions include_transactions = 3;
|
||||||
|
}
|
||||||
|
|
||||||
message GetTransactionByHashRequest {
|
message GetTransactionByHashRequest {
|
||||||
string ledger = 1;
|
string ledger = 1;
|
||||||
bytes hash = 2;
|
bytes hash = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user