mock

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2022 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockBeacon

func NewMockBeacon() (*drand.ChainInfoPacket, *drand.PublicRandResponse)

NewMockBeacon provides a random beacon and the chain it validates against

func NewMockGRPCPublicServer

func NewMockGRPCPublicServer(bind string, badSecondRound bool) (net.Listener, net.Service)

NewMockGRPCPublicServer creates a listener that provides valid single-node randomness.

func NewMockServer

func NewMockServer(badSecondRound bool) net.Service

NewMockServer creates a server interface not bound to a newtork port

Types

type Data

type Data struct {
	Public            []byte
	Signature         string
	Round             int
	PreviousSignature string
	PreviousRound     int
	Genesis           int64
	Period            time.Duration
	BadSecondRound    bool
	// contains filtered or unexported fields
}

Data of signing

type MockService

type MockService interface {
	EmitRand(bool)
}

MockService provides a way for clients getting the service to be able to call the EmitRand method on the mock server

type Server

type Server struct {
	*testnet.EmptyServer
	// contains filtered or unexported fields
}

Server fake

func (*Server) ChainInfo

ChainInfo implements net.Service

func (*Server) EmitRand

func (s *Server) EmitRand(closeStream bool)

EmitRand will cause the next round to be emitted by a previous call to `PublicRandomStream`

func (*Server) PublicRand

PublicRand implements net.Service

func (*Server) PublicRandStream

func (s *Server) PublicRandStream(req *drand.PublicRandRequest, stream drand.Public_PublicRandStreamServer) error

PublicRandStream is part of the public drand service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL