github.com/prysmaticlabs/prysm@v1.4.4/shared/slashutil/surround_votes.go (about)

     1  package slashutil
     2  
     3  import ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
     4  
     5  // IsSurround checks if an attestation, a, is surrounding
     6  // another one, b, based on the Ethereum slashing conditions specified
     7  // by @protolambda https://github.com/protolambda/eth2-surround#definition.
     8  //
     9  //  s: source
    10  //  t: target
    11  //
    12  //  a surrounds b if: s_a < s_b and t_b < t_a
    13  //
    14  func IsSurround(a, b *ethpb.IndexedAttestation) bool {
    15  	return a.Data.Source.Epoch < b.Data.Source.Epoch && b.Data.Target.Epoch < a.Data.Target.Epoch
    16  }