/** * @return the raw {@link org.hyperledger.fabric.protos.peer.PeerEvents.FilteredBlock} */ public PeerEvents.FilteredBlock getFilteredBlock() { return !isFiltered() ? null : filteredBlock; }
/** * @return the {@link Block} previousHash value and null if filtered block. */ public byte[] getPreviousHash() { return isFiltered() ? null : block.getPreviousHash().toByteArray(); }
/** * @return the {@link Block} data hash value and null if filtered block. */ public byte[] getDataHash() { return isFiltered() ? null : block.getDataHash().toByteArray(); }
/** * @return the {@link Block} transaction metadata value return null if filtered block. */ public byte[] getTransActionsMetaData() { return isFiltered() ? null : block.getTransActionsMetaData(); }
/** * @return the raw {@link Block} */ public Block getBlock() { return isFiltered() ? null : block.getBlock(); }
/** * @return the {@link Block} index number */ public long getBlockNumber() { return isFiltered() ? filteredBlock.getNumber() : block.getNumber(); }
/** * @return epoch and -1 if filtered block. * @deprecated */ public long getEpoch() { return BlockInfo.this.isFiltered() ? -1 : headerDeserializer.getChannelHeader().getEpoch(); }
@Override public TransactionActionInfo next() { if (ci >= max) { throw new ArrayIndexOutOfBoundsException(format("Current index: %d. Max index: %d", ci, max)); } // return BlockInfo.this.isFiltered() ? new TransactionActionInfo(filteredTx.getFilteredAction(ci++)) return BlockInfo.this.isFiltered() ? new TransactionActionInfo(filteredTx.getTransactionActions().getChaincodeActions(ci++)) : getTransactionActionInfo(ci++); } }
/** * The transaction ID * * @return the transaction id. */ public String getTransactionID() { return BlockInfo.this.isFiltered() ? filteredTx.getTxid() : headerDeserializer.getChannelHeader().getTxId(); }
/** * Timestamp * * @return timestamp and null if filtered block. */ public Date getTimestamp() { return BlockInfo.this.isFiltered() ? null : ProtoUtils.getDateFromTimestamp(headerDeserializer.getChannelHeader().getTimestamp()); }
public String getChannelId() throws InvalidProtocolBufferException { return isFiltered() ? filteredBlock.getChannelId() : getEnvelopeInfo(0).getChannelId(); }
/** * getEnvelopeCount * * @return the number of transactions in this block. */ public int getEnvelopeCount() { return isFiltered() ? filteredBlock.getFilteredTransactionsCount() : block.getData().getDataCount(); }
/** * Get channel id * * @return The channel id also referred to as channel name. */ public String getChannelId() { return BlockInfo.this.isFiltered() ? filteredBlock.getChannelId() : headerDeserializer.getChannelHeader().getChannelId(); }
/** * @return whether this Transaction is marked as TxValidationCode.VALID */ public boolean isValid() { return BlockInfo.this.isFiltered() ? filteredTx.getTxValidationCode().getNumber() == FabricTransaction.TxValidationCode.VALID_VALUE : envelopeDeserializer.isValid(); }
/** * @return the validation code of this Transaction (enumeration TxValidationCode in Transaction.proto) */ public byte getValidationCode() { if (BlockInfo.this.isFiltered()) { return (byte) filteredTx.getTxValidationCode().getNumber(); } return envelopeDeserializer.validationCode(); }
EnvelopeInfoIterator() { max = isFiltered() ? filteredBlock.getFilteredTransactionsCount() : block.getData().getDataCount(); }
public EnvelopeType getType() { final int type; if (BlockInfo.this.isFiltered()) { type = filteredTx.getTypeValue(); } else { type = headerDeserializer.getChannelHeader().getType(); } switch (type) { case Common.HeaderType.ENDORSER_TRANSACTION_VALUE: return EnvelopeType.TRANSACTION_ENVELOPE; default: return EnvelopeType.ENVELOPE; } }
public TransactionActionInfo getTransactionActionInfo(int index) { return BlockInfo.this.isFiltered() ? new TransactionActionInfo(filteredTx.getTransactionActions().getChaincodeActionsList().get(index)) : new TransactionActionInfo(transactionDeserializer.getPayload().getTransaction().getTransactionAction(index)); }
public int getTransactionActionInfoCount() { return BlockInfo.this.isFiltered() ? filteredTx.getTransactionActions().getChaincodeActionsCount() : transactionDeserializer.getPayload().getTransaction().getActionsCount(); }
/** * Get read write set for this transaction. Will return null on for Eventhub events. * For eventhub events find the block by block number to get read write set if needed. * * @return Read write set. */ public TxReadWriteSetInfo getTxReadWriteSet() { if (BlockInfo.this.isFiltered()) { return null; } else { TxReadWriteSet txReadWriteSet = transactionAction.getPayload().getAction().getProposalResponsePayload() .getExtension().getResults(); if (txReadWriteSet == null) { return null; } return new TxReadWriteSetInfo(txReadWriteSet); } }