예제 #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);
        }
예제 #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);
        }
예제 #3
0
 public static int SignedBeaconBlockLength(SignedBeaconBlock container)
 {
     return(SignedBeaconBlockDynamicOffset + Ssz.BeaconBlockLength(container.Message));
 }