prysm-pulse/validator/testing/mock_protector.go
terencechain d17996f8b0
Update to V4 🚀 (#12134)
* Update V3 from V4

* Fix build v3 -> v4

* Update ssz

* Update beacon_chain.pb.go

* Fix formatter import

* Update update-mockgen.sh comment to v4

* Fix conflicts. Pass build and tests

* Fix test
2023-03-17 18:52:56 +00:00

35 lines
932 B
Go

package testing
import (
"context"
eth "github.com/prysmaticlabs/prysm/v4/proto/prysm/v1alpha1"
)
// MockProtector mocks the protector.
type MockProtector struct {
AllowAttestation bool
AllowBlock bool
VerifyAttestationCalled bool
VerifyBlockCalled bool
StatusCalled bool
}
// CheckAttestationSafety returns bool with allow attestation value.
func (mp MockProtector) CheckAttestationSafety(_ context.Context, _ *eth.IndexedAttestation) bool {
mp.VerifyAttestationCalled = true // skipcq: RVV-B0006
return mp.AllowAttestation
}
// CheckBlockSafety returns bool with allow block value.
func (mp MockProtector) CheckBlockSafety(_ context.Context, _ *eth.SignedBeaconBlockHeader) bool {
mp.VerifyBlockCalled = true // skipcq: RVV-B0006
return mp.AllowBlock
}
// Status returns nil.
func (mp MockProtector) Status() error {
mp.StatusCalled = true // skipcq: RVV-B0006
return nil
}