prysm-pulse/validator/testing/mock_protector.go
terence 5a66807989
Update to V5 (#13622)
* First take at updating everything to v5

* Patch gRPC gateway to use prysm v5

Fix patch

* Update go ssz

---------

Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
2024-02-15 05:46:47 +00:00

35 lines
872 B
Go

package testing
import (
"context"
eth "github.com/prysmaticlabs/prysm/v5/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
return mp.AllowAttestation
}
// CheckBlockSafety returns bool with allow block value.
func (mp *MockProtector) CheckBlockSafety(_ context.Context, _ *eth.SignedBeaconBlockHeader) bool {
mp.VerifyBlockCalled = true
return mp.AllowBlock
}
// Status returns nil.
func (mp *MockProtector) Status() error {
mp.StatusCalled = true
return nil
}