public static void Encode(XdrDataOutputStream stream, LedgerCloseMetaV0 encodedLedgerCloseMetaV0)
        {
            LedgerHeaderHistoryEntry.Encode(stream, encodedLedgerCloseMetaV0.LedgerHeader);
            TransactionSet.Encode(stream, encodedLedgerCloseMetaV0.TxSet);
            int txProcessingsize = encodedLedgerCloseMetaV0.TxProcessing.Length;

            stream.WriteInt(txProcessingsize);
            for (int i = 0; i < txProcessingsize; i++)
            {
                TransactionResultMeta.Encode(stream, encodedLedgerCloseMetaV0.TxProcessing[i]);
            }
            int upgradesProcessingsize = encodedLedgerCloseMetaV0.UpgradesProcessing.Length;

            stream.WriteInt(upgradesProcessingsize);
            for (int i = 0; i < upgradesProcessingsize; i++)
            {
                UpgradeEntryMeta.Encode(stream, encodedLedgerCloseMetaV0.UpgradesProcessing[i]);
            }
            int scpInfosize = encodedLedgerCloseMetaV0.ScpInfo.Length;

            stream.WriteInt(scpInfosize);
            for (int i = 0; i < scpInfosize; i++)
            {
                SCPHistoryEntry.Encode(stream, encodedLedgerCloseMetaV0.ScpInfo[i]);
            }
        }
Example #2
0
        public static void Encode(XdrDataOutputStream stream, StellarMessage encodedStellarMessage)
        {
            stream.WriteInt((int)encodedStellarMessage.Discriminant.InnerValue);
            switch (encodedStellarMessage.Discriminant.InnerValue)
            {
            case MessageType.MessageTypeEnum.ERROR_MSG:
                Error.Encode(stream, encodedStellarMessage.Error);
                break;

            case MessageType.MessageTypeEnum.HELLO:
                Hello.Encode(stream, encodedStellarMessage.Hello);
                break;

            case MessageType.MessageTypeEnum.AUTH:
                Auth.Encode(stream, encodedStellarMessage.Auth);
                break;

            case MessageType.MessageTypeEnum.DONT_HAVE:
                DontHave.Encode(stream, encodedStellarMessage.DontHave);
                break;

            case MessageType.MessageTypeEnum.GET_PEERS:
                break;

            case MessageType.MessageTypeEnum.PEERS:
                int peerssize = encodedStellarMessage.Peers.Length;
                stream.WriteInt(peerssize);
                for (int i = 0; i < peerssize; i++)
                {
                    PeerAddress.Encode(stream, encodedStellarMessage.Peers[i]);
                }

                break;

            case MessageType.MessageTypeEnum.GET_TX_SET:
                Uint256.Encode(stream, encodedStellarMessage.TxSetHash);
                break;

            case MessageType.MessageTypeEnum.TX_SET:
                TransactionSet.Encode(stream, encodedStellarMessage.TxSet);
                break;

            case MessageType.MessageTypeEnum.TRANSACTION:
                TransactionEnvelope.Encode(stream, encodedStellarMessage.Transaction);
                break;

            case MessageType.MessageTypeEnum.GET_SCP_QUORUMSET:
                Uint256.Encode(stream, encodedStellarMessage.QSetHash);
                break;

            case MessageType.MessageTypeEnum.SCP_QUORUMSET:
                SCPQuorumSet.Encode(stream, encodedStellarMessage.QSet);
                break;

            case MessageType.MessageTypeEnum.SCP_MESSAGE:
                SCPEnvelope.Encode(stream, encodedStellarMessage.Envelope);
                break;

            case MessageType.MessageTypeEnum.GET_SCP_STATE:
                Uint32.Encode(stream, encodedStellarMessage.GetSCPLedgerSeq);
                break;
            }
        }
Example #3
0
 public static void Encode(XdrDataOutputStream stream, TransactionHistoryEntry encodedTransactionHistoryEntry)
 {
     Uint32.Encode(stream, encodedTransactionHistoryEntry.LedgerSeq);
     TransactionSet.Encode(stream, encodedTransactionHistoryEntry.TxSet);
     TransactionHistoryEntryExt.Encode(stream, encodedTransactionHistoryEntry.Ext);
 }