Search in sources :

Example 1 with BlockMetadata

use of org.hyperledger.fabric.protos.common.Common.BlockMetadata in project fabric-sdk-java by hyperledger.

the class Channel method getLastConfigIndex.

private long getLastConfigIndex(Orderer orderer) throws TransactionException, InvalidProtocolBufferException {
    Block latestBlock = getLatestBlock(orderer);
    BlockMetadata blockMetadata = latestBlock.getMetadata();
    Metadata metaData = Metadata.parseFrom(blockMetadata.getMetadata(1));
    LastConfig lastConfig = LastConfig.parseFrom(metaData.getValue());
    return lastConfig.getIndex();
}
Also used : LastConfig(org.hyperledger.fabric.protos.common.Common.LastConfig) BlockMetadata(org.hyperledger.fabric.protos.common.Common.BlockMetadata) BlockMetadata(org.hyperledger.fabric.protos.common.Common.BlockMetadata) Metadata(org.hyperledger.fabric.protos.common.Common.Metadata) Block(org.hyperledger.fabric.protos.common.Common.Block)

Aggregations

Block (org.hyperledger.fabric.protos.common.Common.Block)1 BlockMetadata (org.hyperledger.fabric.protos.common.Common.BlockMetadata)1 LastConfig (org.hyperledger.fabric.protos.common.Common.LastConfig)1 Metadata (org.hyperledger.fabric.protos.common.Common.Metadata)1