예제 #1
0
 /// <summary>
 /// Check if ``data_1`` and ``data_2`` are slashable according to Casper FFG rules.
 /// </summary>
 public bool IsSlashableAttestationData(AttestationData data1, AttestationData data2)
 {
     bool isDoubleVote = data1.Target.Epoch == data2.Target.Epoch && !data1.Equals(data2);
     bool isSurroundVote = data1.Source.Epoch < data2.Source.Epoch && data2.Target.Epoch < data1.Target.Epoch;
     bool isSlashable = isDoubleVote || isSurroundVote;
     return isSlashable;
 }
예제 #2
0
        /// <summary>
        /// Check if ``data_1`` and ``data_2`` are slashable according to Casper FFG rules.
        /// </summary>
        public bool IsSlashableAttestationData(AttestationData data1, AttestationData data2)
        {
            bool isSlashable =
                // Double vote
                (data1.Target.Epoch == data2.Target.Epoch && !data1.Equals(data2))
                // Surround vote
                || (data1.Source.Epoch < data2.Source.Epoch && data2.Target.Epoch < data1.Target.Epoch);

            return(isSlashable);
        }