Update proto

This commit is contained in:
Xiaomin Zhu 2020-03-07 17:31:38 +08:00
parent 4e3edab38d
commit d4c57607e2
6 changed files with 241 additions and 242 deletions

View File

@ -21,7 +21,7 @@ import java.util.logging.Logger;
/**
* 事务账本客户端
*
* <p>如有更灵活的需求可直接使用{@link bdledger.api.grpc.ledger.TransactionLedgerGrpc}
* <p>如有更灵活的需求可直接使用{@link bdledger.api.grpc.ledger.LedgerGrpc}
*
* @author nex
* @see <a href="#">事务账本API</a>
@ -33,8 +33,8 @@ public class Client {
private final ManagedChannel channel;
private final NodeGrpc.NodeFutureStub nodeFutureStub;
private final NodeGrpc.NodeBlockingStub nodeBlockingStub;
private final TransactionLedgerGrpc.TransactionLedgerFutureStub ledgerFutureStub;
private final TransactionLedgerGrpc.TransactionLedgerBlockingStub ledgerBlockingStub;
private final LedgerGrpc.LedgerFutureStub ledgerFutureStub;
private final LedgerGrpc.LedgerBlockingStub ledgerBlockingStub;
private final QueryGrpc.QueryFutureStub queryFutureStub;
private final QueryGrpc.QueryBlockingStub queryBlockingStub;
@ -52,8 +52,8 @@ public class Client {
channel = channelBuilder.build();
nodeFutureStub = NodeGrpc.newFutureStub(channel);
nodeBlockingStub = NodeGrpc.newBlockingStub(channel);
ledgerFutureStub = TransactionLedgerGrpc.newFutureStub(channel);
ledgerBlockingStub = TransactionLedgerGrpc.newBlockingStub(channel);
ledgerFutureStub = LedgerGrpc.newFutureStub(channel);
ledgerBlockingStub = LedgerGrpc.newBlockingStub(channel);
queryFutureStub = QueryGrpc.newFutureStub(channel);
queryBlockingStub = QueryGrpc.newBlockingStub(channel);
}

View File

@ -55,17 +55,12 @@ private static final long serialVersionUID = 0L;
case 0:
done = true;
break;
case 8: {
index_ = input.readUInt64();
break;
}
case 18: {
case 10: {
hash_ = input.readBytes();
break;
}
case 26: {
case 18: {
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
parentHashes_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
mutable_bitField0_ |= 0x00000001;
@ -73,7 +68,7 @@ private static final long serialVersionUID = 0L;
parentHashes_.add(input.readBytes());
break;
}
case 34: {
case 26: {
if (!((mutable_bitField0_ & 0x00000002) != 0)) {
witnesses_ = new java.util.ArrayList<com.google.protobuf.ByteString>();
mutable_bitField0_ |= 0x00000002;
@ -81,16 +76,21 @@ private static final long serialVersionUID = 0L;
witnesses_.add(input.readBytes());
break;
}
case 40: {
case 32: {
timestamp_ = input.readInt64();
break;
}
case 48: {
case 40: {
size_ = input.readUInt64();
break;
}
case 48: {
transactionCount_ = input.readUInt32();
break;
}
case 58: {
transactionsRoot_ = input.readBytes();
@ -157,42 +157,28 @@ private static final long serialVersionUID = 0L;
bdledger.api.grpc.common.Block.class, bdledger.api.grpc.common.Block.Builder.class);
}
public static final int INDEX_FIELD_NUMBER = 1;
private long index_;
/**
* <pre>
* 事务链本地区块索引当区块处于待确认状态时为`null`
* </pre>
*
* <code>uint64 index = 1;</code>
* @return The index.
*/
public long getIndex() {
return index_;
}
public static final int HASH_FIELD_NUMBER = 2;
public static final int HASH_FIELD_NUMBER = 1;
private com.google.protobuf.ByteString hash_;
/**
* <pre>
* 区块的哈希当区块处于待确认状态时为`null`
* </pre>
*
* <code>bytes hash = 2;</code>
* <code>bytes hash = 1;</code>
* @return The hash.
*/
public com.google.protobuf.ByteString getHash() {
return hash_;
}
public static final int PARENT_HASHES_FIELD_NUMBER = 3;
public static final int PARENT_HASHES_FIELD_NUMBER = 2;
private java.util.List<com.google.protobuf.ByteString> parentHashes_;
/**
* <pre>
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @return A list containing the parentHashes.
*/
public java.util.List<com.google.protobuf.ByteString>
@ -204,7 +190,7 @@ private static final long serialVersionUID = 0L;
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @return The count of parentHashes.
*/
public int getParentHashesCount() {
@ -215,7 +201,7 @@ private static final long serialVersionUID = 0L;
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @param index The index of the element to return.
* @return The parentHashes at the given index.
*/
@ -223,14 +209,14 @@ private static final long serialVersionUID = 0L;
return parentHashes_.get(index);
}
public static final int WITNESSES_FIELD_NUMBER = 4;
public static final int WITNESSES_FIELD_NUMBER = 3;
private java.util.List<com.google.protobuf.ByteString> witnesses_;
/**
* <pre>
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @return A list containing the witnesses.
*/
public java.util.List<com.google.protobuf.ByteString>
@ -242,7 +228,7 @@ private static final long serialVersionUID = 0L;
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @return The count of witnesses.
*/
public int getWitnessesCount() {
@ -253,7 +239,7 @@ private static final long serialVersionUID = 0L;
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @param index The index of the element to return.
* @return The witnesses at the given index.
*/
@ -261,39 +247,53 @@ private static final long serialVersionUID = 0L;
return witnesses_.get(index);
}
public static final int TIMESTAMP_FIELD_NUMBER = 5;
public static final int TIMESTAMP_FIELD_NUMBER = 4;
private long timestamp_;
/**
* <pre>
* 区块产生时的 UNIX 时间戳单位为秒
* </pre>
*
* <code>int64 timestamp = 5;</code>
* <code>int64 timestamp = 4;</code>
* @return The timestamp.
*/
public long getTimestamp() {
return timestamp_;
}
public static final int SIZE_FIELD_NUMBER = 6;
public static final int SIZE_FIELD_NUMBER = 5;
private long size_;
/**
* <pre>
* 区块大小的字节数
* </pre>
*
* <code>uint64 size = 6;</code>
* <code>uint64 size = 5;</code>
* @return The size.
*/
public long getSize() {
return size_;
}
public static final int TRANSACTION_COUNT_FIELD_NUMBER = 6;
private int transactionCount_;
/**
* <pre>
* 区块包含的事务数量
* </pre>
*
* <code>uint32 transaction_count = 6;</code>
* @return The transactionCount.
*/
public int getTransactionCount() {
return transactionCount_;
}
public static final int TRANSACTIONS_ROOT_FIELD_NUMBER = 7;
private com.google.protobuf.ByteString transactionsRoot_;
/**
* <pre>
* 区块的事务树根
* 区块的事务默克尔树根
* </pre>
*
* <code>bytes transactions_root = 7;</code>
@ -410,23 +410,23 @@ private static final long serialVersionUID = 0L;
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (index_ != 0L) {
output.writeUInt64(1, index_);
}
if (!hash_.isEmpty()) {
output.writeBytes(2, hash_);
output.writeBytes(1, hash_);
}
for (int i = 0; i < parentHashes_.size(); i++) {
output.writeBytes(3, parentHashes_.get(i));
output.writeBytes(2, parentHashes_.get(i));
}
for (int i = 0; i < witnesses_.size(); i++) {
output.writeBytes(4, witnesses_.get(i));
output.writeBytes(3, witnesses_.get(i));
}
if (timestamp_ != 0L) {
output.writeInt64(5, timestamp_);
output.writeInt64(4, timestamp_);
}
if (size_ != 0L) {
output.writeUInt64(6, size_);
output.writeUInt64(5, size_);
}
if (transactionCount_ != 0) {
output.writeUInt32(6, transactionCount_);
}
if (!transactionsRoot_.isEmpty()) {
output.writeBytes(7, transactionsRoot_);
@ -446,13 +446,9 @@ private static final long serialVersionUID = 0L;
if (size != -1) return size;
size = 0;
if (index_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(1, index_);
}
if (!hash_.isEmpty()) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, hash_);
.computeBytesSize(1, hash_);
}
{
int dataSize = 0;
@ -474,11 +470,15 @@ private static final long serialVersionUID = 0L;
}
if (timestamp_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(5, timestamp_);
.computeInt64Size(4, timestamp_);
}
if (size_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(6, size_);
.computeUInt64Size(5, size_);
}
if (transactionCount_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(6, transactionCount_);
}
if (!transactionsRoot_.isEmpty()) {
size += com.google.protobuf.CodedOutputStream
@ -512,8 +512,6 @@ private static final long serialVersionUID = 0L;
}
bdledger.api.grpc.common.Block other = (bdledger.api.grpc.common.Block) obj;
if (getIndex()
!= other.getIndex()) return false;
if (!getHash()
.equals(other.getHash())) return false;
if (!getParentHashesList()
@ -524,6 +522,8 @@ private static final long serialVersionUID = 0L;
!= other.getTimestamp()) return false;
if (getSize()
!= other.getSize()) return false;
if (getTransactionCount()
!= other.getTransactionCount()) return false;
if (!getTransactionsRoot()
.equals(other.getTransactionsRoot())) return false;
if (!getTransactionsList()
@ -541,9 +541,6 @@ private static final long serialVersionUID = 0L;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + INDEX_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getIndex());
hash = (37 * hash) + HASH_FIELD_NUMBER;
hash = (53 * hash) + getHash().hashCode();
if (getParentHashesCount() > 0) {
@ -560,6 +557,8 @@ private static final long serialVersionUID = 0L;
hash = (37 * hash) + SIZE_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getSize());
hash = (37 * hash) + TRANSACTION_COUNT_FIELD_NUMBER;
hash = (53 * hash) + getTransactionCount();
hash = (37 * hash) + TRANSACTIONS_ROOT_FIELD_NUMBER;
hash = (53 * hash) + getTransactionsRoot().hashCode();
if (getTransactionsCount() > 0) {
@ -704,8 +703,6 @@ private static final long serialVersionUID = 0L;
@java.lang.Override
public Builder clear() {
super.clear();
index_ = 0L;
hash_ = com.google.protobuf.ByteString.EMPTY;
parentHashes_ = java.util.Collections.emptyList();
@ -716,6 +713,8 @@ private static final long serialVersionUID = 0L;
size_ = 0L;
transactionCount_ = 0;
transactionsRoot_ = com.google.protobuf.ByteString.EMPTY;
if (transactionsBuilder_ == null) {
@ -753,7 +752,6 @@ private static final long serialVersionUID = 0L;
public bdledger.api.grpc.common.Block buildPartial() {
bdledger.api.grpc.common.Block result = new bdledger.api.grpc.common.Block(this);
int from_bitField0_ = bitField0_;
result.index_ = index_;
result.hash_ = hash_;
if (((bitField0_ & 0x00000001) != 0)) {
parentHashes_ = java.util.Collections.unmodifiableList(parentHashes_);
@ -767,6 +765,7 @@ private static final long serialVersionUID = 0L;
result.witnesses_ = witnesses_;
result.timestamp_ = timestamp_;
result.size_ = size_;
result.transactionCount_ = transactionCount_;
result.transactionsRoot_ = transactionsRoot_;
if (transactionsBuilder_ == null) {
if (((bitField0_ & 0x00000004) != 0)) {
@ -830,9 +829,6 @@ private static final long serialVersionUID = 0L;
public Builder mergeFrom(bdledger.api.grpc.common.Block other) {
if (other == bdledger.api.grpc.common.Block.getDefaultInstance()) return this;
if (other.getIndex() != 0L) {
setIndex(other.getIndex());
}
if (other.getHash() != com.google.protobuf.ByteString.EMPTY) {
setHash(other.getHash());
}
@ -862,6 +858,9 @@ private static final long serialVersionUID = 0L;
if (other.getSize() != 0L) {
setSize(other.getSize());
}
if (other.getTransactionCount() != 0) {
setTransactionCount(other.getTransactionCount());
}
if (other.getTransactionsRoot() != com.google.protobuf.ByteString.EMPTY) {
setTransactionsRoot(other.getTransactionsRoot());
}
@ -931,55 +930,13 @@ private static final long serialVersionUID = 0L;
}
private int bitField0_;
private long index_ ;
/**
* <pre>
* 事务链本地区块索引当区块处于待确认状态时为`null`
* </pre>
*
* <code>uint64 index = 1;</code>
* @return The index.
*/
public long getIndex() {
return index_;
}
/**
* <pre>
* 事务链本地区块索引当区块处于待确认状态时为`null`
* </pre>
*
* <code>uint64 index = 1;</code>
* @param value The index to set.
* @return This builder for chaining.
*/
public Builder setIndex(long value) {
index_ = value;
onChanged();
return this;
}
/**
* <pre>
* 事务链本地区块索引当区块处于待确认状态时为`null`
* </pre>
*
* <code>uint64 index = 1;</code>
* @return This builder for chaining.
*/
public Builder clearIndex() {
index_ = 0L;
onChanged();
return this;
}
private com.google.protobuf.ByteString hash_ = com.google.protobuf.ByteString.EMPTY;
/**
* <pre>
* 区块的哈希当区块处于待确认状态时为`null`
* </pre>
*
* <code>bytes hash = 2;</code>
* <code>bytes hash = 1;</code>
* @return The hash.
*/
public com.google.protobuf.ByteString getHash() {
@ -990,7 +947,7 @@ private static final long serialVersionUID = 0L;
* 区块的哈希当区块处于待确认状态时为`null`
* </pre>
*
* <code>bytes hash = 2;</code>
* <code>bytes hash = 1;</code>
* @param value The hash to set.
* @return This builder for chaining.
*/
@ -1008,7 +965,7 @@ private static final long serialVersionUID = 0L;
* 区块的哈希当区块处于待确认状态时为`null`
* </pre>
*
* <code>bytes hash = 2;</code>
* <code>bytes hash = 1;</code>
* @return This builder for chaining.
*/
public Builder clearHash() {
@ -1030,7 +987,7 @@ private static final long serialVersionUID = 0L;
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @return A list containing the parentHashes.
*/
public java.util.List<com.google.protobuf.ByteString>
@ -1043,7 +1000,7 @@ private static final long serialVersionUID = 0L;
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @return The count of parentHashes.
*/
public int getParentHashesCount() {
@ -1054,7 +1011,7 @@ private static final long serialVersionUID = 0L;
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @param index The index of the element to return.
* @return The parentHashes at the given index.
*/
@ -1066,7 +1023,7 @@ private static final long serialVersionUID = 0L;
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @param index The index to set the value at.
* @param value The parentHashes to set.
* @return This builder for chaining.
@ -1086,7 +1043,7 @@ private static final long serialVersionUID = 0L;
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @param value The parentHashes to add.
* @return This builder for chaining.
*/
@ -1104,7 +1061,7 @@ private static final long serialVersionUID = 0L;
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @param values The parentHashes to add.
* @return This builder for chaining.
*/
@ -1121,7 +1078,7 @@ private static final long serialVersionUID = 0L;
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @return This builder for chaining.
*/
public Builder clearParentHashes() {
@ -1143,7 +1100,7 @@ private static final long serialVersionUID = 0L;
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @return A list containing the witnesses.
*/
public java.util.List<com.google.protobuf.ByteString>
@ -1156,7 +1113,7 @@ private static final long serialVersionUID = 0L;
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @return The count of witnesses.
*/
public int getWitnessesCount() {
@ -1167,7 +1124,7 @@ private static final long serialVersionUID = 0L;
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @param index The index of the element to return.
* @return The witnesses at the given index.
*/
@ -1179,7 +1136,7 @@ private static final long serialVersionUID = 0L;
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @param index The index to set the value at.
* @param value The witnesses to set.
* @return This builder for chaining.
@ -1199,7 +1156,7 @@ private static final long serialVersionUID = 0L;
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @param value The witnesses to add.
* @return This builder for chaining.
*/
@ -1217,7 +1174,7 @@ private static final long serialVersionUID = 0L;
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @param values The witnesses to add.
* @return This builder for chaining.
*/
@ -1234,7 +1191,7 @@ private static final long serialVersionUID = 0L;
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @return This builder for chaining.
*/
public Builder clearWitnesses() {
@ -1250,7 +1207,7 @@ private static final long serialVersionUID = 0L;
* 区块产生时的 UNIX 时间戳单位为秒
* </pre>
*
* <code>int64 timestamp = 5;</code>
* <code>int64 timestamp = 4;</code>
* @return The timestamp.
*/
public long getTimestamp() {
@ -1261,7 +1218,7 @@ private static final long serialVersionUID = 0L;
* 区块产生时的 UNIX 时间戳单位为秒
* </pre>
*
* <code>int64 timestamp = 5;</code>
* <code>int64 timestamp = 4;</code>
* @param value The timestamp to set.
* @return This builder for chaining.
*/
@ -1276,7 +1233,7 @@ private static final long serialVersionUID = 0L;
* 区块产生时的 UNIX 时间戳单位为秒
* </pre>
*
* <code>int64 timestamp = 5;</code>
* <code>int64 timestamp = 4;</code>
* @return This builder for chaining.
*/
public Builder clearTimestamp() {
@ -1292,7 +1249,7 @@ private static final long serialVersionUID = 0L;
* 区块大小的字节数
* </pre>
*
* <code>uint64 size = 6;</code>
* <code>uint64 size = 5;</code>
* @return The size.
*/
public long getSize() {
@ -1303,7 +1260,7 @@ private static final long serialVersionUID = 0L;
* 区块大小的字节数
* </pre>
*
* <code>uint64 size = 6;</code>
* <code>uint64 size = 5;</code>
* @param value The size to set.
* @return This builder for chaining.
*/
@ -1318,7 +1275,7 @@ private static final long serialVersionUID = 0L;
* 区块大小的字节数
* </pre>
*
* <code>uint64 size = 6;</code>
* <code>uint64 size = 5;</code>
* @return This builder for chaining.
*/
public Builder clearSize() {
@ -1328,10 +1285,52 @@ private static final long serialVersionUID = 0L;
return this;
}
private int transactionCount_ ;
/**
* <pre>
* 区块包含的事务数量
* </pre>
*
* <code>uint32 transaction_count = 6;</code>
* @return The transactionCount.
*/
public int getTransactionCount() {
return transactionCount_;
}
/**
* <pre>
* 区块包含的事务数量
* </pre>
*
* <code>uint32 transaction_count = 6;</code>
* @param value The transactionCount to set.
* @return This builder for chaining.
*/
public Builder setTransactionCount(int value) {
transactionCount_ = value;
onChanged();
return this;
}
/**
* <pre>
* 区块包含的事务数量
* </pre>
*
* <code>uint32 transaction_count = 6;</code>
* @return This builder for chaining.
*/
public Builder clearTransactionCount() {
transactionCount_ = 0;
onChanged();
return this;
}
private com.google.protobuf.ByteString transactionsRoot_ = com.google.protobuf.ByteString.EMPTY;
/**
* <pre>
* 区块的事务树根
* 区块的事务默克尔树根
* </pre>
*
* <code>bytes transactions_root = 7;</code>
@ -1342,7 +1341,7 @@ private static final long serialVersionUID = 0L;
}
/**
* <pre>
* 区块的事务树根
* 区块的事务默克尔树根
* </pre>
*
* <code>bytes transactions_root = 7;</code>
@ -1360,7 +1359,7 @@ private static final long serialVersionUID = 0L;
}
/**
* <pre>
* 区块的事务树根
* 区块的事务默克尔树根
* </pre>
*
* <code>bytes transactions_root = 7;</code>

View File

@ -7,22 +7,12 @@ public interface BlockOrBuilder extends
// @@protoc_insertion_point(interface_extends:bdledger.api.Block)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
* 事务链本地区块索引当区块处于待确认状态时为`null`
* </pre>
*
* <code>uint64 index = 1;</code>
* @return The index.
*/
long getIndex();
/**
* <pre>
* 区块的哈希当区块处于待确认状态时为`null`
* </pre>
*
* <code>bytes hash = 2;</code>
* <code>bytes hash = 1;</code>
* @return The hash.
*/
com.google.protobuf.ByteString getHash();
@ -32,7 +22,7 @@ public interface BlockOrBuilder extends
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @return A list containing the parentHashes.
*/
java.util.List<com.google.protobuf.ByteString> getParentHashesList();
@ -41,7 +31,7 @@ public interface BlockOrBuilder extends
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @return The count of parentHashes.
*/
int getParentHashesCount();
@ -50,7 +40,7 @@ public interface BlockOrBuilder extends
* 父区块的哈希
* </pre>
*
* <code>repeated bytes parent_hashes = 3;</code>
* <code>repeated bytes parent_hashes = 2;</code>
* @param index The index of the element to return.
* @return The parentHashes at the given index.
*/
@ -61,7 +51,7 @@ public interface BlockOrBuilder extends
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @return A list containing the witnesses.
*/
java.util.List<com.google.protobuf.ByteString> getWitnessesList();
@ -70,7 +60,7 @@ public interface BlockOrBuilder extends
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @return The count of witnesses.
*/
int getWitnessesCount();
@ -79,7 +69,7 @@ public interface BlockOrBuilder extends
* 见证者账户地址
* </pre>
*
* <code>repeated bytes witnesses = 4;</code>
* <code>repeated bytes witnesses = 3;</code>
* @param index The index of the element to return.
* @return The witnesses at the given index.
*/
@ -90,7 +80,7 @@ public interface BlockOrBuilder extends
* 区块产生时的 UNIX 时间戳单位为秒
* </pre>
*
* <code>int64 timestamp = 5;</code>
* <code>int64 timestamp = 4;</code>
* @return The timestamp.
*/
long getTimestamp();
@ -100,14 +90,24 @@ public interface BlockOrBuilder extends
* 区块大小的字节数
* </pre>
*
* <code>uint64 size = 6;</code>
* <code>uint64 size = 5;</code>
* @return The size.
*/
long getSize();
/**
* <pre>
* 区块的事务树根
* 区块包含的事务数量
* </pre>
*
* <code>uint32 transaction_count = 6;</code>
* @return The transactionCount.
*/
int getTransactionCount();
/**
* <pre>
* 区块的事务默克尔树根
* </pre>
*
* <code>bytes transactions_root = 7;</code>

View File

@ -39,17 +39,17 @@ public final class CommonProto {
"2\035.bdledger.api.TransactionType\022\014\n\004from\030" +
"\005 \001(\014\022\r\n\005nonce\030\006 \001(\004\022\n\n\002to\030\007 \001(\014\022\014\n\004data" +
"\030\010 \001(\014\022\t\n\001v\030\t \001(\014\022\t\n\001r\030\n \001(\014\022\t\n\001s\030\013 \001(\014\"" +
"\327\001\n\005Block\022\r\n\005index\030\001 \001(\004\022\014\n\004hash\030\002 \001(\014\022\025" +
"\n\rparent_hashes\030\003 \003(\014\022\021\n\twitnesses\030\004 \003(\014" +
"\022\021\n\ttimestamp\030\005 \001(\003\022\014\n\004size\030\006 \001(\004\022\031\n\021tra" +
"nsactions_root\030\007 \001(\014\022/\n\014transactions\030\010 \003" +
"(\0132\031.bdledger.api.Transaction\022\032\n\022transac" +
"tion_hashes\030\t \003(\014*o\n\017TransactionType\022\n\n\006" +
"RECORD\020\000\022\013\n\007MESSAGE\020\001\022\025\n\021CONTRACT_CREATI" +
"ON\020\002\022\027\n\023CONTRACT_INVOCATION\020\003\022\023\n\017CONTRAC" +
"T_STATUS\020\004BQ\n\030bdledger.api.grpc.commonB\013" +
"CommonProtoP\001Z&bdware.org/bdledger/pkg/a" +
"pi/grpc/protob\006proto3"
"\343\001\n\005Block\022\014\n\004hash\030\001 \001(\014\022\025\n\rparent_hashes" +
"\030\002 \003(\014\022\021\n\twitnesses\030\003 \003(\014\022\021\n\ttimestamp\030\004" +
" \001(\003\022\014\n\004size\030\005 \001(\004\022\031\n\021transaction_count\030" +
"\006 \001(\r\022\031\n\021transactions_root\030\007 \001(\014\022/\n\014tran" +
"sactions\030\010 \003(\0132\031.bdledger.api.Transactio" +
"n\022\032\n\022transaction_hashes\030\t \003(\014*o\n\017Transac" +
"tionType\022\n\n\006RECORD\020\000\022\013\n\007MESSAGE\020\001\022\025\n\021CON" +
"TRACT_CREATION\020\002\022\027\n\023CONTRACT_INVOCATION\020" +
"\003\022\023\n\017CONTRACT_STATUS\020\004BQ\n\030bdledger.api.g" +
"rpc.commonB\013CommonProtoP\001Z&bdware.org/bd" +
"ledger/pkg/api/grpc/protob\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
@ -66,7 +66,7 @@ public final class CommonProto {
internal_static_bdledger_api_Block_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_bdledger_api_Block_descriptor,
new java.lang.String[] { "Index", "Hash", "ParentHashes", "Witnesses", "Timestamp", "Size", "TransactionsRoot", "Transactions", "TransactionHashes", });
new java.lang.String[] { "Hash", "ParentHashes", "Witnesses", "Timestamp", "Size", "TransactionCount", "TransactionsRoot", "Transactions", "TransactionHashes", });
}
// @@protoc_insertion_point(outer_class_scope)

View File

@ -20,11 +20,11 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.27.0)",
comments = "Source: bdledger/api/ledger.proto")
public final class TransactionLedgerGrpc {
public final class LedgerGrpc {
private TransactionLedgerGrpc() {}
private LedgerGrpc() {}
public static final String SERVICE_NAME = "bdledger.api.TransactionLedger";
public static final String SERVICE_NAME = "bdledger.api.Ledger";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<bdledger.api.grpc.ledger.CreateLedgerRequest,
@ -38,10 +38,10 @@ public final class TransactionLedgerGrpc {
public static io.grpc.MethodDescriptor<bdledger.api.grpc.ledger.CreateLedgerRequest,
bdledger.api.grpc.ledger.CreateLedgerResponse> getCreateLedgerMethod() {
io.grpc.MethodDescriptor<bdledger.api.grpc.ledger.CreateLedgerRequest, bdledger.api.grpc.ledger.CreateLedgerResponse> getCreateLedgerMethod;
if ((getCreateLedgerMethod = TransactionLedgerGrpc.getCreateLedgerMethod) == null) {
synchronized (TransactionLedgerGrpc.class) {
if ((getCreateLedgerMethod = TransactionLedgerGrpc.getCreateLedgerMethod) == null) {
TransactionLedgerGrpc.getCreateLedgerMethod = getCreateLedgerMethod =
if ((getCreateLedgerMethod = LedgerGrpc.getCreateLedgerMethod) == null) {
synchronized (LedgerGrpc.class) {
if ((getCreateLedgerMethod = LedgerGrpc.getCreateLedgerMethod) == null) {
LedgerGrpc.getCreateLedgerMethod = getCreateLedgerMethod =
io.grpc.MethodDescriptor.<bdledger.api.grpc.ledger.CreateLedgerRequest, bdledger.api.grpc.ledger.CreateLedgerResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateLedger"))
@ -50,7 +50,7 @@ public final class TransactionLedgerGrpc {
bdledger.api.grpc.ledger.CreateLedgerRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
bdledger.api.grpc.ledger.CreateLedgerResponse.getDefaultInstance()))
.setSchemaDescriptor(new TransactionLedgerMethodDescriptorSupplier("CreateLedger"))
.setSchemaDescriptor(new LedgerMethodDescriptorSupplier("CreateLedger"))
.build();
}
}
@ -69,10 +69,10 @@ public final class TransactionLedgerGrpc {
public static io.grpc.MethodDescriptor<com.google.protobuf.Empty,
bdledger.api.grpc.ledger.GetLedgersResponse> getGetLedgersMethod() {
io.grpc.MethodDescriptor<com.google.protobuf.Empty, bdledger.api.grpc.ledger.GetLedgersResponse> getGetLedgersMethod;
if ((getGetLedgersMethod = TransactionLedgerGrpc.getGetLedgersMethod) == null) {
synchronized (TransactionLedgerGrpc.class) {
if ((getGetLedgersMethod = TransactionLedgerGrpc.getGetLedgersMethod) == null) {
TransactionLedgerGrpc.getGetLedgersMethod = getGetLedgersMethod =
if ((getGetLedgersMethod = LedgerGrpc.getGetLedgersMethod) == null) {
synchronized (LedgerGrpc.class) {
if ((getGetLedgersMethod = LedgerGrpc.getGetLedgersMethod) == null) {
LedgerGrpc.getGetLedgersMethod = getGetLedgersMethod =
io.grpc.MethodDescriptor.<com.google.protobuf.Empty, bdledger.api.grpc.ledger.GetLedgersResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetLedgers"))
@ -81,7 +81,7 @@ public final class TransactionLedgerGrpc {
com.google.protobuf.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
bdledger.api.grpc.ledger.GetLedgersResponse.getDefaultInstance()))
.setSchemaDescriptor(new TransactionLedgerMethodDescriptorSupplier("GetLedgers"))
.setSchemaDescriptor(new LedgerMethodDescriptorSupplier("GetLedgers"))
.build();
}
}
@ -100,10 +100,10 @@ public final class TransactionLedgerGrpc {
public static io.grpc.MethodDescriptor<bdledger.api.grpc.ledger.SendTransactionRequest,
bdledger.api.grpc.ledger.SendTransactionResponse> getSendTransactionMethod() {
io.grpc.MethodDescriptor<bdledger.api.grpc.ledger.SendTransactionRequest, bdledger.api.grpc.ledger.SendTransactionResponse> getSendTransactionMethod;
if ((getSendTransactionMethod = TransactionLedgerGrpc.getSendTransactionMethod) == null) {
synchronized (TransactionLedgerGrpc.class) {
if ((getSendTransactionMethod = TransactionLedgerGrpc.getSendTransactionMethod) == null) {
TransactionLedgerGrpc.getSendTransactionMethod = getSendTransactionMethod =
if ((getSendTransactionMethod = LedgerGrpc.getSendTransactionMethod) == null) {
synchronized (LedgerGrpc.class) {
if ((getSendTransactionMethod = LedgerGrpc.getSendTransactionMethod) == null) {
LedgerGrpc.getSendTransactionMethod = getSendTransactionMethod =
io.grpc.MethodDescriptor.<bdledger.api.grpc.ledger.SendTransactionRequest, bdledger.api.grpc.ledger.SendTransactionResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "SendTransaction"))
@ -112,7 +112,7 @@ public final class TransactionLedgerGrpc {
bdledger.api.grpc.ledger.SendTransactionRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
bdledger.api.grpc.ledger.SendTransactionResponse.getDefaultInstance()))
.setSchemaDescriptor(new TransactionLedgerMethodDescriptorSupplier("SendTransaction"))
.setSchemaDescriptor(new LedgerMethodDescriptorSupplier("SendTransaction"))
.build();
}
}
@ -123,50 +123,50 @@ public final class TransactionLedgerGrpc {
/**
* Creates a new async stub that supports all call types for the service
*/
public static TransactionLedgerStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<TransactionLedgerStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<TransactionLedgerStub>() {
public static LedgerStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<LedgerStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<LedgerStub>() {
@java.lang.Override
public TransactionLedgerStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TransactionLedgerStub(channel, callOptions);
public LedgerStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LedgerStub(channel, callOptions);
}
};
return TransactionLedgerStub.newStub(factory, channel);
return LedgerStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static TransactionLedgerBlockingStub newBlockingStub(
public static LedgerBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<TransactionLedgerBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<TransactionLedgerBlockingStub>() {
io.grpc.stub.AbstractStub.StubFactory<LedgerBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<LedgerBlockingStub>() {
@java.lang.Override
public TransactionLedgerBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TransactionLedgerBlockingStub(channel, callOptions);
public LedgerBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LedgerBlockingStub(channel, callOptions);
}
};
return TransactionLedgerBlockingStub.newStub(factory, channel);
return LedgerBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static TransactionLedgerFutureStub newFutureStub(
public static LedgerFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<TransactionLedgerFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<TransactionLedgerFutureStub>() {
io.grpc.stub.AbstractStub.StubFactory<LedgerFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<LedgerFutureStub>() {
@java.lang.Override
public TransactionLedgerFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TransactionLedgerFutureStub(channel, callOptions);
public LedgerFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LedgerFutureStub(channel, callOptions);
}
};
return TransactionLedgerFutureStub.newStub(factory, channel);
return LedgerFutureStub.newStub(factory, channel);
}
/**
*/
public static abstract class TransactionLedgerImplBase implements io.grpc.BindableService {
public static abstract class LedgerImplBase implements io.grpc.BindableService {
/**
*/
@ -218,16 +218,16 @@ public final class TransactionLedgerGrpc {
/**
*/
public static final class TransactionLedgerStub extends io.grpc.stub.AbstractAsyncStub<TransactionLedgerStub> {
private TransactionLedgerStub(
public static final class LedgerStub extends io.grpc.stub.AbstractAsyncStub<LedgerStub> {
private LedgerStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected TransactionLedgerStub build(
protected LedgerStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TransactionLedgerStub(channel, callOptions);
return new LedgerStub(channel, callOptions);
}
/**
@ -257,16 +257,16 @@ public final class TransactionLedgerGrpc {
/**
*/
public static final class TransactionLedgerBlockingStub extends io.grpc.stub.AbstractBlockingStub<TransactionLedgerBlockingStub> {
private TransactionLedgerBlockingStub(
public static final class LedgerBlockingStub extends io.grpc.stub.AbstractBlockingStub<LedgerBlockingStub> {
private LedgerBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected TransactionLedgerBlockingStub build(
protected LedgerBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TransactionLedgerBlockingStub(channel, callOptions);
return new LedgerBlockingStub(channel, callOptions);
}
/**
@ -293,16 +293,16 @@ public final class TransactionLedgerGrpc {
/**
*/
public static final class TransactionLedgerFutureStub extends io.grpc.stub.AbstractFutureStub<TransactionLedgerFutureStub> {
private TransactionLedgerFutureStub(
public static final class LedgerFutureStub extends io.grpc.stub.AbstractFutureStub<LedgerFutureStub> {
private LedgerFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected TransactionLedgerFutureStub build(
protected LedgerFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TransactionLedgerFutureStub(channel, callOptions);
return new LedgerFutureStub(channel, callOptions);
}
/**
@ -339,10 +339,10 @@ public final class TransactionLedgerGrpc {
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final TransactionLedgerImplBase serviceImpl;
private final LedgerImplBase serviceImpl;
private final int methodId;
MethodHandlers(TransactionLedgerImplBase serviceImpl, int methodId) {
MethodHandlers(LedgerImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@ -379,9 +379,9 @@ public final class TransactionLedgerGrpc {
}
}
private static abstract class TransactionLedgerBaseDescriptorSupplier
private static abstract class LedgerBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
TransactionLedgerBaseDescriptorSupplier() {}
LedgerBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
@ -390,21 +390,21 @@ public final class TransactionLedgerGrpc {
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("TransactionLedger");
return getFileDescriptor().findServiceByName("Ledger");
}
}
private static final class TransactionLedgerFileDescriptorSupplier
extends TransactionLedgerBaseDescriptorSupplier {
TransactionLedgerFileDescriptorSupplier() {}
private static final class LedgerFileDescriptorSupplier
extends LedgerBaseDescriptorSupplier {
LedgerFileDescriptorSupplier() {}
}
private static final class TransactionLedgerMethodDescriptorSupplier
extends TransactionLedgerBaseDescriptorSupplier
private static final class LedgerMethodDescriptorSupplier
extends LedgerBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
TransactionLedgerMethodDescriptorSupplier(String methodName) {
LedgerMethodDescriptorSupplier(String methodName) {
this.methodName = methodName;
}
@ -419,11 +419,11 @@ public final class TransactionLedgerGrpc {
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (TransactionLedgerGrpc.class) {
synchronized (LedgerGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new TransactionLedgerFileDescriptorSupplier())
.setSchemaDescriptor(new LedgerFileDescriptorSupplier())
.addMethod(getCreateLedgerMethod())
.addMethod(getGetLedgersMethod())
.addMethod(getSendTransactionMethod())

View File

@ -64,16 +64,16 @@ public final class LedgerProto {
"ion\032b\n\013Transaction\022+\n\004type\030\001 \001(\0162\035.bdled" +
"ger.api.TransactionType\022\014\n\004from\030\002 \001(\014\022\n\n" +
"\002to\030\003 \001(\014\022\014\n\004data\030\004 \001(\014\"\'\n\027SendTransacti" +
"onResponse\022\014\n\004hash\030\001 \001(\0142\222\002\n\021Transaction" +
"Ledger\022U\n\014CreateLedger\022!.bdledger.api.Cr" +
"eateLedgerRequest\032\".bdledger.api.CreateL" +
"edgerResponse\022F\n\nGetLedgers\022\026.google.pro" +
"tobuf.Empty\032 .bdledger.api.GetLedgersRes" +
"ponse\022^\n\017SendTransaction\022$.bdledger.api." +
"SendTransactionRequest\032%.bdledger.api.Se" +
"ndTransactionResponseBQ\n\030bdledger.api.gr" +
"pc.ledgerB\013LedgerProtoP\001Z&bdware.org/bdl" +
"edger/pkg/api/grpc/protob\006proto3"
"onResponse\022\014\n\004hash\030\001 \001(\0142\207\002\n\006Ledger\022U\n\014C" +
"reateLedger\022!.bdledger.api.CreateLedgerR" +
"equest\032\".bdledger.api.CreateLedgerRespon" +
"se\022F\n\nGetLedgers\022\026.google.protobuf.Empty" +
"\032 .bdledger.api.GetLedgersResponse\022^\n\017Se" +
"ndTransaction\022$.bdledger.api.SendTransac" +
"tionRequest\032%.bdledger.api.SendTransacti" +
"onResponseBQ\n\030bdledger.api.grpc.ledgerB\013" +
"LedgerProtoP\001Z&bdware.org/bdledger/pkg/a" +
"pi/grpc/protob\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,