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 void Encode(XdrDataOutputStream stream, StellarValue encodedStellarValue) { Hash.Encode(stream, encodedStellarValue.TxSetHash); TimePoint.Encode(stream, encodedStellarValue.CloseTime); int upgradessize = encodedStellarValue.Upgrades.Length; stream.WriteInt(upgradessize); for (int i = 0; i < upgradessize; i++) { UpgradeType.Encode(stream, encodedStellarValue.Upgrades[i]); } StellarValueExt.Encode(stream, encodedStellarValue.Ext); }
public static StellarValue Decode(XdrDataInputStream stream) { StellarValue decodedStellarValue = new StellarValue(); decodedStellarValue.TxSetHash = Hash.Decode(stream); decodedStellarValue.CloseTime = TimePoint.Decode(stream); int upgradessize = stream.ReadInt(); 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, 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); }