mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
5aac06f04e
* begin move * use same import path * imports * regen protos * regen * no rename * generate ssz * gaz * fmt * edit build file * imports * modify * remove generated files * remove protos * edit imports in prysm * beacon chain all builds * edit script * add generated pbs * add replace rules * license for ethereumapis protos * change visibility * fmt * update build files to gaz ignore * use proper form * edit imports * wrap block * revert scripts * revert go mod
49 lines
1.3 KiB
Go
49 lines
1.3 KiB
Go
package testing
|
|
|
|
import (
|
|
"context"
|
|
|
|
eth "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
|
|
)
|
|
|
|
// MockProtector mocks the protector.
|
|
type MockProtector struct {
|
|
AllowAttestation bool
|
|
AllowBlock bool
|
|
VerifyAttestationCalled bool
|
|
CommitAttestationCalled bool
|
|
VerifyBlockCalled bool
|
|
CommitBlockCalled 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
|
|
}
|
|
|
|
// CommitAttestation returns bool with allow attestation value.
|
|
func (mp MockProtector) CommitAttestation(_ context.Context, _ *eth.IndexedAttestation) bool {
|
|
mp.CommitAttestationCalled = true
|
|
return mp.AllowAttestation
|
|
}
|
|
|
|
// CheckBlockSafety returns bool with allow block value.
|
|
func (mp MockProtector) CheckBlockSafety(_ context.Context, _ *eth.BeaconBlockHeader) bool {
|
|
mp.VerifyBlockCalled = true
|
|
return mp.AllowBlock
|
|
}
|
|
|
|
// CommitBlock returns bool with allow block value.
|
|
func (mp MockProtector) CommitBlock(_ context.Context, _ *eth.SignedBeaconBlockHeader) (bool, error) {
|
|
mp.CommitBlockCalled = true
|
|
return mp.AllowBlock, nil
|
|
}
|
|
|
|
// Status returns nil.
|
|
func (mp MockProtector) Status() error {
|
|
mp.StatusCalled = true
|
|
return nil
|
|
}
|