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

     1  package slashutil
     2  
     3  import "github.com/prysmaticlabs/prysm/shared/params"
     4  
     5  // SigningRootsDiffer verifies that an incoming vs. existing attestation has a different signing root.
     6  // If the existing signing root is empty, then we consider an attestation as different always.
     7  func SigningRootsDiffer(existingSigningRoot, incomingSigningRoot [32]byte) bool {
     8  	zeroHash := params.BeaconConfig().ZeroHash
     9  	// If the existing signing root is empty, we always consider the incoming
    10  	// attestation as a double vote to be safe.
    11  	if existingSigningRoot == zeroHash {
    12  		return true
    13  	}
    14  	// Otherwise, we consider any sort of inequality to be a double vote.
    15  	return existingSigningRoot != incomingSigningRoot
    16  }