Ejemplo n.º 1
0
        public static int SszLength(BeaconBlockBody?container)
        {
            if (container is null)
            {
                return(0);
            }

            int result = SszDynamicOffset;

            result += ProposerSlashing.SszLength * (container.ProposerSlashings?.Length ?? 0);
            result += Deposit.SszLength * (container.Deposits?.Length ?? 0);
            result += VoluntaryExit.SszLength * (container.VoluntaryExits?.Length ?? 0);

            result += sizeof(uint) * (container.AttesterSlashings?.Length ?? 0);
            if (!(container.AttesterSlashings is null))
            {
                for (int i = 0; i < container.AttesterSlashings.Length; i++)
                {
                    result += AttesterSlashing.SszLength(container.AttesterSlashings[i]);
                }
            }

            result += sizeof(uint) * (container.Attestations?.Length ?? 0);
            if (!(container.Attestations is null))
            {
                for (int i = 0; i < container.Attestations.Length; i++)
                {
                    result += Attestation.SszLength(container.Attestations[i]);
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public static int SszLength(BeaconBlockBody container)
        {
            int result = SszDynamicOffset;

            result += ProposerSlashing.SszLength * container.ProposerSlashings.Length;
            result += Deposit.SszLength * container.Deposits.Length;
            result += VoluntaryExit.SszLength * container.VoluntaryExits.Length;

            result += sizeof(uint) * container.AttesterSlashings.Length;
            for (int i = 0; i < container.AttesterSlashings.Length; i++)
            {
                result += AttesterSlashing.SszLength(container.AttesterSlashings[i]);
            }

            result += sizeof(uint) * container.Attestations.Length;
            for (int i = 0; i < container.Attestations.Length; i++)
            {
                result += Attestation.SszLength(container.Attestations[i]);
            }

            return(result);
        }