mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
26 lines
618 B
Go
26 lines
618 B
Go
package testing
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/gogo/protobuf/proto"
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
|
)
|
|
|
|
// MockBroadcaster implements p2p.Broadcaster for testing.
|
|
type MockBroadcaster struct {
|
|
BroadcastCalled bool
|
|
}
|
|
|
|
// Broadcast records a broadcast occurred.
|
|
func (m *MockBroadcaster) Broadcast(context.Context, proto.Message) error {
|
|
m.BroadcastCalled = true
|
|
return nil
|
|
}
|
|
|
|
// BroadcastAttestation records a broadcast occurred.
|
|
func (m *MockBroadcaster) BroadcastAttestation(ctx context.Context, subnet uint64, att *ethpb.Attestation) error {
|
|
m.BroadcastCalled = true
|
|
return nil
|
|
}
|