prysm-pulse/shared/slashutil/surround_votes.go
Raul Jordan d97596348e
Add Back New Attester Protection DB Logic (#8242)
* Revert "Revert New Attester Protection DB Logic (#8237)"

This reverts commit 6738fa3493.

* Batch Attestation Records and Flush All at Once in Validator DB (#8243)

* begin flushing logic

* finalize logic before starting tests

* make code DRY

* better log fields

* gaz

* tweak parameter

* rename

* clarifying comment on error handling in event feed

* comprehensive tests

* more comments

* explain parameters in comments

* renamed consts

* Apply suggestions from code review

* gaz

* simplify

* typo

* comments
2021-01-11 23:59:17 +00:00

17 lines
522 B
Go

package slashutil
import ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
// IsSurround checks if an attestation, a, is surrounding
// another one, b, based on the eth2 slashing conditions specified
// by @protolambda https://github.com/protolambda/eth2-surround#definition.
//
// s: source
// t: target
//
// a surrounds b if: s_a < s_b and t_b < t_a
//
func IsSurround(a, b *ethpb.IndexedAttestation) bool {
return a.Data.Source.Epoch < b.Data.Source.Epoch && b.Data.Target.Epoch < a.Data.Target.Epoch
}