Beispiel #1
0
        public static LedgerHeader Decode(XdrDataInputStream stream)
        {
            var 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);
            var skipListsize = 4;

            decodedLedgerHeader.SkipList = new Hash[skipListsize];
            for (var i = 0; i < skipListsize; i++)
            {
                decodedLedgerHeader.SkipList[i] = Hash.Decode(stream);
            }
            decodedLedgerHeader.Ext = LedgerHeaderExt.Decode(stream);
            return(decodedLedgerHeader);
        }
 public static void Encode(IByteWriter stream, StellarValue encodedStellarValue) {
   Hash.Encode(stream, encodedStellarValue.TxSetHash);
   Uint64.Encode(stream, encodedStellarValue.CloseTime);
   int upgradessize = encodedStellarValue.Upgrades.Length;
   XdrEncoding.EncodeInt32(upgradessize, stream);
   for (int i = 0; i < upgradessize; i++) {
     UpgradeType.Encode(stream, encodedStellarValue.Upgrades[i]);
   }
   StellarValueExt.Encode(stream, encodedStellarValue.Ext);
 }
 public static StellarValue Decode(IByteReader stream) {
   StellarValue decodedStellarValue = new StellarValue();
   decodedStellarValue.TxSetHash = Hash.Decode(stream);
   decodedStellarValue.CloseTime = Uint64.Decode(stream);
   int upgradessize = XdrEncoding.DecodeInt32(stream);
   decodedStellarValue.Upgrades = new UpgradeType[upgradessize];
   for (int i = 0; i < upgradessize; i++) {
     decodedStellarValue.Upgrades[i] = UpgradeType.Decode(stream);
   }
   decodedStellarValue.Ext = StellarValueExt.Decode(stream);
   return decodedStellarValue;
 }
        public static void Encode(XdrDataOutputStream stream, StellarValue encodedStellarValue)
        {
            Hash.Encode(stream, encodedStellarValue.TxSetHash);
            Uint64.Encode(stream, encodedStellarValue.CloseTime);
            var upgradessize = encodedStellarValue.Upgrades.Length;

            stream.WriteInt(upgradessize);
            for (var i = 0; i < upgradessize; i++)
            {
                UpgradeType.Encode(stream, encodedStellarValue.Upgrades[i]);
            }
            StellarValueExt.Encode(stream, encodedStellarValue.Ext);
        }
        public static void Encode(IByteWriter stream, StellarValue encodedStellarValue)
        {
            Hash.Encode(stream, encodedStellarValue.TxSetHash);
            Uint64.Encode(stream, encodedStellarValue.CloseTime);
            int upgradessize = encodedStellarValue.Upgrades.Length;

            XdrEncoding.EncodeInt32(upgradessize, stream);
            for (int i = 0; i < upgradessize; i++)
            {
                UpgradeType.Encode(stream, encodedStellarValue.Upgrades[i]);
            }
            StellarValueExt.Encode(stream, encodedStellarValue.Ext);
        }
        public static StellarValue Decode(XdrDataInputStream stream)
        {
            var decodedStellarValue = new StellarValue();

            decodedStellarValue.TxSetHash = Hash.Decode(stream);
            decodedStellarValue.CloseTime = Uint64.Decode(stream);
            var upgradessize = stream.ReadInt();

            decodedStellarValue.Upgrades = new UpgradeType[upgradessize];
            for (var i = 0; i < upgradessize; i++)
            {
                decodedStellarValue.Upgrades[i] = UpgradeType.Decode(stream);
            }
            decodedStellarValue.Ext = StellarValueExt.Decode(stream);
            return(decodedStellarValue);
        }
        public static StellarValue Decode(IByteReader stream)
        {
            StellarValue decodedStellarValue = new StellarValue();

            decodedStellarValue.TxSetHash = Hash.Decode(stream);
            decodedStellarValue.CloseTime = Uint64.Decode(stream);
            int upgradessize = XdrEncoding.DecodeInt32(stream);

            decodedStellarValue.Upgrades = new UpgradeType[upgradessize];
            for (int i = 0; i < upgradessize; i++)
            {
                decodedStellarValue.Upgrades[i] = UpgradeType.Decode(stream);
            }
            decodedStellarValue.Ext = StellarValueExt.Decode(stream);
            return(decodedStellarValue);
        }
Beispiel #8
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);
            var skipListsize = encodedLedgerHeader.SkipList.Length;

            for (var i = 0; i < skipListsize; i++)
            {
                Hash.Encode(stream, encodedLedgerHeader.SkipList[i]);
            }
            LedgerHeaderExt.Encode(stream, encodedLedgerHeader.Ext);
        }