Example #1
0
        public static void Encode(Span <byte> span, BeaconBlock container)
        {
            if (span.Length != Ssz.BeaconBlockLength(container))
            {
                ThrowTargetLength <BeaconBlock>(span.Length, Ssz.BeaconBlockLength(container));
            }
            int offset = 0;

            Encode(span, container, ref offset);
        }
Example #2
0
        public static void Encode(Span <byte> span, BeaconBlock container)
        {
            if (span.Length != Ssz.BeaconBlockLength(container))
            {
                ThrowTargetLength <BeaconBlock>(span.Length, Ssz.BeaconBlockLength(container));
            }
            int offset = 0;

            Encode(span, container.Slot, ref offset);
            Encode(span, container.ParentRoot, ref offset);
            Encode(span, container.StateRoot, ref offset);
            Encode(span, Ssz.BeaconBlockDynamicOffset, ref offset);
            Encode(span, container.Signature, ref offset);
            Encode(span.Slice(offset), container.Body);
        }
Example #3
0
 public static int SignedBeaconBlockLength(SignedBeaconBlock container)
 {
     return(SignedBeaconBlockDynamicOffset + Ssz.BeaconBlockLength(container.Message));
 }