コード例 #1
0
        public static LedgerEntry ReadLedgerEntry(this StReader reader)
        {
            var index = reader.ReadHash256();
            var obj   = reader.ReadVlStObject();

            obj[Field.index] = index;
            return(new LedgerEntry(obj));
        }
コード例 #2
0
        public static TransactionResult ReadTransactionResult(this StReader reader, uint ledgerIndex = 0)
        {
            var hash = reader.ReadHash256();
            var txn  = reader.ReadVlStObject();
            var meta = reader.ReadVlStObject();

            txn[Field.hash] = hash;
            return(new TransactionResult(txn, meta, ledgerIndex));
        }
コード例 #3
0
ファイル: LedgerHeader.cs プロジェクト: fs0c131y/BitfiSources
        }                                             // Flags

        public static LedgerHeader FromReader(StReader reader)
        {
            var pos = reader.Parser().Pos();
            // ReSharper disable once UseObjectOrCollectionInitializer
            var header = new LedgerHeader();

            header.LedgerIndex     = reader.ReadUint32();
            header.TotalDrops      = reader.ReadUint64();
            header.ParentHash      = reader.ReadHash256();
            header.TransactionHash = reader.ReadHash256();
            header.StateHash       = reader.ReadHash256();
            header.ParentCloseTime = reader.ReadUint32();
            header.CloseTime       = reader.ReadUint32();
            header.CloseResolution = reader.ReadUint8();
            header.CloseFlags      = reader.ReadUint8();

            if (reader.Parser().Pos() != pos + 118)
            {
                throw new InvalidOperationException();
            }
            return(header);
        }
コード例 #4
0
ファイル: LedgerObject.cs プロジェクト: Ibasa/Ripple
        public Majority(ref StReader reader)
        {
            var fieldId = reader.ReadFieldId();

            if (fieldId != StFieldId.UInt32_CloseTime)
            {
                throw new Exception(string.Format("Expected {0} but got {1}", StFieldId.UInt32_CloseTime, fieldId));
            }
            CloseTime = Epoch.ToDateTimeOffset(reader.ReadUInt32());
            fieldId   = reader.ReadFieldId();
            if (fieldId != StFieldId.Hash256_Amendment)
            {
                throw new Exception(string.Format("Expected {0} but got {1}", StFieldId.Hash256_Amendment, fieldId));
            }
            Amendment = reader.ReadHash256();
            fieldId   = reader.ReadFieldId();
            if (fieldId != StFieldId.Object_ObjectEndMarker)
            {
                throw new Exception(string.Format("Expected {0} but got {1}", StFieldId.Object_ObjectEndMarker, fieldId));
            }
        }