prysm-pulse/validator/testing/mock_protector.go
Raul Jordan df33ce3309
Remaining Slasher Beacon Node Changes (#9701)
* slasher beacon node changes

* remaining beacon node items

* moar changes

* gaz

* flag fix

* rem slashable

* builds

* imports

* fix up

* pruning faster test

* deepsource

* fix wrong item

* node node feature flags

* broken test

* preston review

* more preston comments

* comment

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-09-29 18:17:37 +00:00

35 lines
866 B
Go

package testing
import (
"context"
eth "github.com/prysmaticlabs/prysm/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
}