Beispiel #1
0
        /**
         * Return a specific envelope in the block by it's index.
         *
         * @param envelopeIndex
         * @return EnvelopeInfo that contains information on the envelope.
         * @throws InvalidProtocolBufferException
         */

        public EnvelopeInfo GetEnvelopeInfo(int envelopeIndex)
        {
            EnvelopeInfo ret;

            if (IsFiltered)
            {
                switch (filteredBlock.FilteredTransactions[envelopeIndex].Type)
                {
                case HeaderType.EndorserTransaction:
                    ret = new TransactionEnvelopeInfo(this, filteredBlock.FilteredTransactions[envelopeIndex]);
                    break;

                default:     //just assume base properties.
                    ret = new EnvelopeInfo(this, filteredBlock.FilteredTransactions[envelopeIndex]);
                    break;
                }
            }
            else
            {
                EnvelopeDeserializer ed = EnvelopeDeserializer.Create(block.Block.Data.Data[envelopeIndex], block.TransActionsMetaData[envelopeIndex]);

                switch (ed.Type)
                {
                case (int)HeaderType.EndorserTransaction:
                    ret = new TransactionEnvelopeInfo(this, (EndorserTransactionEnvDeserializer)ed);
                    break;

                default:     //just assume base properties.
                    ret = new EnvelopeInfo(this, ed);
                    break;
                }
            }

            return(ret);
        }
Beispiel #2
0
        public TransactionEvent GetTransactionEvent(int index)
        {
            TransactionEvent ret = null;

            EnvelopeInfo envelopeInfo = GetEnvelopeInfo(index);

            if (envelopeInfo.EnvelopeType == EnvelopeType.TRANSACTION_ENVELOPE)
            {
                ret = IsFiltered ? new TransactionEvent(this, envelopeInfo.FilteredTX) : new TransactionEvent(this, (TransactionEnvelopeInfo)envelopeInfo);
            }

            return(ret);
        }