2019-08-22 18:11:52 +00:00
|
|
|
package testing
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/gogo/protobuf/proto"
|
2020-06-09 22:40:48 +00:00
|
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
2019-08-22 18:11:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|
2020-06-09 22:40:48 +00:00
|
|
|
|
|
|
|
// BroadcastAttestation records a broadcast occurred.
|
2020-10-12 08:11:05 +00:00
|
|
|
func (m *MockBroadcaster) BroadcastAttestation(_ context.Context, _ uint64, _ *ethpb.Attestation) error {
|
2020-06-09 22:40:48 +00:00
|
|
|
m.BroadcastCalled = true
|
|
|
|
return nil
|
|
|
|
}
|