mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
ff99616833
* Fix violations of sa2002 * Fix violations of sa4005 * Fix violations of sa4010 * Fix violations for sa4023 * Comment on commented static checks
35 lines
872 B
Go
35 lines
872 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
|
|
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
|
|
}
|