Exemplo n.º 1
0
        public static LedgerHeader Decode(XdrDataInputStream stream)
        {
            LedgerHeader decodedLedgerHeader = new LedgerHeader();

            decodedLedgerHeader.LedgerVersion      = Uint32.Decode(stream);
            decodedLedgerHeader.PreviousLedgerHash = Hash.Decode(stream);
            decodedLedgerHeader.ScpValue           = StellarValue.Decode(stream);
            decodedLedgerHeader.TxSetResultHash    = Hash.Decode(stream);
            decodedLedgerHeader.BucketListHash     = Hash.Decode(stream);
            decodedLedgerHeader.LedgerSeq          = Uint32.Decode(stream);
            decodedLedgerHeader.TotalCoins         = Int64.Decode(stream);
            decodedLedgerHeader.FeePool            = Int64.Decode(stream);
            decodedLedgerHeader.InflationSeq       = Uint32.Decode(stream);
            decodedLedgerHeader.IdPool             = Uint64.Decode(stream);
            decodedLedgerHeader.BaseFee            = Uint32.Decode(stream);
            decodedLedgerHeader.BaseReserve        = Uint32.Decode(stream);
            decodedLedgerHeader.MaxTxSetSize       = Uint32.Decode(stream);
            int skipListsize = 4;

            decodedLedgerHeader.SkipList = new Hash[skipListsize];
            for (int i = 0; i < skipListsize; i++)
            {
                decodedLedgerHeader.SkipList[i] = Hash.Decode(stream);
            }
            decodedLedgerHeader.Ext = LedgerHeaderExt.Decode(stream);
            return(decodedLedgerHeader);
        }
        public static LedgerHeaderHistoryEntry Decode(XdrDataInputStream stream)
        {
            LedgerHeaderHistoryEntry decodedLedgerHeaderHistoryEntry = new LedgerHeaderHistoryEntry();

            decodedLedgerHeaderHistoryEntry.Hash   = Hash.Decode(stream);
            decodedLedgerHeaderHistoryEntry.Header = LedgerHeader.Decode(stream);
            decodedLedgerHeaderHistoryEntry.Ext    = LedgerHeaderHistoryEntryExt.Decode(stream);
            return(decodedLedgerHeaderHistoryEntry);
        }
Exemplo n.º 3
0
        public static void Encode(XdrDataOutputStream stream, LedgerHeader encodedLedgerHeader)
        {
            Uint32.Encode(stream, encodedLedgerHeader.LedgerVersion);
            Hash.Encode(stream, encodedLedgerHeader.PreviousLedgerHash);
            StellarValue.Encode(stream, encodedLedgerHeader.ScpValue);
            Hash.Encode(stream, encodedLedgerHeader.TxSetResultHash);
            Hash.Encode(stream, encodedLedgerHeader.BucketListHash);
            Uint32.Encode(stream, encodedLedgerHeader.LedgerSeq);
            Int64.Encode(stream, encodedLedgerHeader.TotalCoins);
            Int64.Encode(stream, encodedLedgerHeader.FeePool);
            Uint32.Encode(stream, encodedLedgerHeader.InflationSeq);
            Uint64.Encode(stream, encodedLedgerHeader.IdPool);
            Uint32.Encode(stream, encodedLedgerHeader.BaseFee);
            Uint32.Encode(stream, encodedLedgerHeader.BaseReserve);
            Uint32.Encode(stream, encodedLedgerHeader.MaxTxSetSize);
            int skipListsize = encodedLedgerHeader.SkipList.Length;

            for (int i = 0; i < skipListsize; i++)
            {
                Hash.Encode(stream, encodedLedgerHeader.SkipList[i]);
            }
            LedgerHeaderExt.Encode(stream, encodedLedgerHeader.Ext);
        }
 public static void Encode(XdrDataOutputStream stream, LedgerHeaderHistoryEntry encodedLedgerHeaderHistoryEntry)
 {
     Hash.Encode(stream, encodedLedgerHeaderHistoryEntry.Hash);
     LedgerHeader.Encode(stream, encodedLedgerHeaderHistoryEntry.Header);
     LedgerHeaderHistoryEntryExt.Encode(stream, encodedLedgerHeaderHistoryEntry.Ext);
 }