Class LedgerHeader

java.lang.Object
org.stellar.sdk.xdr.LedgerHeader
All Implemented Interfaces:
XdrElement

public class LedgerHeader extends Object implements XdrElement
LedgerHeader's original definition in the XDR file is:
 struct LedgerHeader
 {
     uint32 ledgerVersion;    // the protocol version of the ledger
     Hash previousLedgerHash; // hash of the previous ledger header
     StellarValue scpValue;   // what consensus agreed to
     Hash txSetResultHash;    // the TransactionResultSet that led to this ledger
     Hash bucketListHash;     // hash of the ledger state

     uint32 ledgerSeq; // sequence number of this ledger

     int64 totalCoins; // total number of stroops in existence.
                       // 10,000,000 stroops in 1 XLM

     int64 feePool;       // fees burned since last inflation run
     uint32 inflationSeq; // inflation sequence number

     uint64 idPool; // last used global ID, used for generating objects

     uint32 baseFee;     // base fee per operation in stroops
     uint32 baseReserve; // account base reserve in stroops

     uint32 maxTxSetSize; // maximum size a transaction set can be

     Hash skipList[4]; // hashes of ledgers in the past. allows you to jump back
                       // in time without walking the chain back ledger by ledger
                       // each slot contains the oldest ledger that is mod of
                       // either 50  5000  50000 or 500000 depending on index
                       // skipList[0] mod(50), skipList[1] mod(5000), etc

     // reserved for future use
     union switch (int v)
     {
     case 0:
         void;
     case 1:
         LedgerHeaderExtensionV1 v1;
     }
     ext;
 };
 
  • Constructor Details

    • LedgerHeader

      public LedgerHeader()
    • LedgerHeader

      public LedgerHeader(Uint32 ledgerVersion, Hash previousLedgerHash, StellarValue scpValue, Hash txSetResultHash, Hash bucketListHash, Uint32 ledgerSeq, Int64 totalCoins, Int64 feePool, Uint32 inflationSeq, Uint64 idPool, Uint32 baseFee, Uint32 baseReserve, Uint32 maxTxSetSize, Hash[] skipList, LedgerHeader.LedgerHeaderExt ext)
      Creates a new LedgerHeader instance.
      Parameters:
      ledgerVersion - the ledgerVersion field value
      previousLedgerHash - the previousLedgerHash field value
      scpValue - the scpValue field value
      txSetResultHash - the txSetResultHash field value
      bucketListHash - the bucketListHash field value
      ledgerSeq - the ledgerSeq field value
      totalCoins - the totalCoins field value
      feePool - the feePool field value
      inflationSeq - the inflationSeq field value
      idPool - the idPool field value
      baseFee - the baseFee field value
      baseReserve - the baseReserve field value
      maxTxSetSize - the maxTxSetSize field value
      skipList - the skipList field value
      ext - the ext field value
  • Method Details

    • encode

      public void encode(XdrDataOutputStream stream) throws IOException
      Description copied from interface: XdrElement
      Encodes this value to XDR and writes it to the provided stream.
      Specified by:
      encode in interface XdrElement
      Parameters:
      stream - the destination XDR output stream
      Throws:
      IOException - if an I/O error occurs while writing the value
    • decode

      public static LedgerHeader decode(XdrDataInputStream stream, int maxDepth) throws IOException
      Throws:
      IOException
    • decode

      public static LedgerHeader decode(XdrDataInputStream stream) throws IOException
      Throws:
      IOException
    • fromXdrBase64

      public static LedgerHeader fromXdrBase64(String xdr) throws IOException
      Throws:
      IOException
    • fromXdrByteArray

      public static LedgerHeader fromXdrByteArray(byte[] xdr) throws IOException
      Throws:
      IOException
    • toJson

      public String toJson()
      Description copied from interface: XdrElement
      Serializes this value to JSON.
      Specified by:
      toJson in interface XdrElement
      Returns:
      the JSON representation of this value
    • fromJson

      public static LedgerHeader fromJson(String json)
    • builder

      public static LedgerHeader.LedgerHeaderBuilder builder()
    • toBuilder

    • getLedgerVersion

      public Uint32 getLedgerVersion()
      Value of the ledgerVersion field.
      Returns:
      the ledgerVersion field value
    • getPreviousLedgerHash

      public Hash getPreviousLedgerHash()
      Value of the previousLedgerHash field.
      Returns:
      the previousLedgerHash field value
    • getScpValue

      public StellarValue getScpValue()
      Value of the scpValue field.
      Returns:
      the scpValue field value
    • getTxSetResultHash

      public Hash getTxSetResultHash()
      Value of the txSetResultHash field.
      Returns:
      the txSetResultHash field value
    • getBucketListHash

      public Hash getBucketListHash()
      Value of the bucketListHash field.
      Returns:
      the bucketListHash field value
    • getLedgerSeq

      public Uint32 getLedgerSeq()
      Value of the ledgerSeq field.
      Returns:
      the ledgerSeq field value
    • getTotalCoins

      public Int64 getTotalCoins()
      Value of the totalCoins field.
      Returns:
      the totalCoins field value
    • getFeePool

      public Int64 getFeePool()
      Value of the feePool field.
      Returns:
      the feePool field value
    • getInflationSeq

      public Uint32 getInflationSeq()
      Value of the inflationSeq field.
      Returns:
      the inflationSeq field value
    • getIdPool

      public Uint64 getIdPool()
      Value of the idPool field.
      Returns:
      the idPool field value
    • getBaseFee

      public Uint32 getBaseFee()
      Value of the baseFee field.
      Returns:
      the baseFee field value
    • getBaseReserve

      public Uint32 getBaseReserve()
      Value of the baseReserve field.
      Returns:
      the baseReserve field value
    • getMaxTxSetSize

      public Uint32 getMaxTxSetSize()
      Value of the maxTxSetSize field.
      Returns:
      the maxTxSetSize field value
    • getSkipList

      public Hash[] getSkipList()
      Value of the skipList field.
      Returns:
      the skipList field value
    • getExt

      Value of the ext field.
      Returns:
      the ext field value
    • setLedgerVersion

      public void setLedgerVersion(Uint32 ledgerVersion)
      Value of the ledgerVersion field.
      Parameters:
      ledgerVersion - the ledgerVersion field value
    • setPreviousLedgerHash

      public void setPreviousLedgerHash(Hash previousLedgerHash)
      Value of the previousLedgerHash field.
      Parameters:
      previousLedgerHash - the previousLedgerHash field value
    • setScpValue

      public void setScpValue(StellarValue scpValue)
      Value of the scpValue field.
      Parameters:
      scpValue - the scpValue field value
    • setTxSetResultHash

      public void setTxSetResultHash(Hash txSetResultHash)
      Value of the txSetResultHash field.
      Parameters:
      txSetResultHash - the txSetResultHash field value
    • setBucketListHash

      public void setBucketListHash(Hash bucketListHash)
      Value of the bucketListHash field.
      Parameters:
      bucketListHash - the bucketListHash field value
    • setLedgerSeq

      public void setLedgerSeq(Uint32 ledgerSeq)
      Value of the ledgerSeq field.
      Parameters:
      ledgerSeq - the ledgerSeq field value
    • setTotalCoins

      public void setTotalCoins(Int64 totalCoins)
      Value of the totalCoins field.
      Parameters:
      totalCoins - the totalCoins field value
    • setFeePool

      public void setFeePool(Int64 feePool)
      Value of the feePool field.
      Parameters:
      feePool - the feePool field value
    • setInflationSeq

      public void setInflationSeq(Uint32 inflationSeq)
      Value of the inflationSeq field.
      Parameters:
      inflationSeq - the inflationSeq field value
    • setIdPool

      public void setIdPool(Uint64 idPool)
      Value of the idPool field.
      Parameters:
      idPool - the idPool field value
    • setBaseFee

      public void setBaseFee(Uint32 baseFee)
      Value of the baseFee field.
      Parameters:
      baseFee - the baseFee field value
    • setBaseReserve

      public void setBaseReserve(Uint32 baseReserve)
      Value of the baseReserve field.
      Parameters:
      baseReserve - the baseReserve field value
    • setMaxTxSetSize

      public void setMaxTxSetSize(Uint32 maxTxSetSize)
      Value of the maxTxSetSize field.
      Parameters:
      maxTxSetSize - the maxTxSetSize field value
    • setSkipList

      public void setSkipList(Hash[] skipList)
      Value of the skipList field.
      Parameters:
      skipList - the skipList field value
    • setExt

      public void setExt(LedgerHeader.LedgerHeaderExt ext)
      Value of the ext field.
      Parameters:
      ext - the ext field value
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object