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); }
public static int SszLength(Attestation container) { if (container == null) { return(0); } return(SszDynamicOffset + container.AggregationBits.Length); }
public bool Equals(Attestation other) { if (!Equals(Data, other.Data) || !Equals(Signature, other.Signature) || AggregationBits.Count != other.AggregationBits.Count) { return(false); } for (int i = 0; i < AggregationBits.Count; i++) { if (AggregationBits[i] != other.AggregationBits[i]) { return(false); } } return(true); }
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); }
public void AddAttestations(Attestation attestation) => _attestations.Add(attestation);
public bool Equals(Attestation other) { return(Bytes.AreEqual(AggregationBits, other.AggregationBits) && Equals(Data, other.Data) && Equals(Signature, other.Signature)); }