示例#1
0
        void IInteroperable.FromStackItem(StackItem stackItem)
        {
            Struct @struct = (Struct)stackItem;

            BlockIndex      = (uint)@struct[0].GetInteger();
            _rawTransaction = ((ByteString)@struct[1]).Memory;
            Transaction     = _rawTransaction.AsSerializable <Transaction>();
            State           = (VMState)(byte)@struct[2].GetInteger();
        }
示例#2
0
        public static ConsensusMessage DeserializeFrom(ReadOnlyMemory <byte> data)
        {
            ConsensusMessageType type = (ConsensusMessageType)data.Span[0];
            Type t = typeof(ConsensusMessage);

            t = t.Assembly.GetType($"{t.Namespace}.{type}", false);
            if (t is null)
            {
                throw new FormatException();
            }
            return((ConsensusMessage)data.AsSerializable(t));
        }