Add query.GetRecentBlocks

This commit is contained in:
Nex 2020-09-04 12:22:44 +08:00
parent 9cf9fb061b
commit d775b43e96

View File

@ -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;