From 188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 2 Feb 2016 19:06:43 +0200 Subject: cmd, common, node, rpc: move IPC into the node itself --- node/utils_test.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'node/utils_test.go') diff --git a/node/utils_test.go b/node/utils_test.go index 7755605ae..7cdfc2b3a 100644 --- a/node/utils_test.go +++ b/node/utils_test.go @@ -52,6 +52,7 @@ func NewNoopServiceD(*ServiceContext) (Service, error) { return new(NoopServiceD // methods can be instrumented both return value as well as event hook wise. type InstrumentedService struct { protocols []p2p.Protocol + apis []rpc.API start error stop error @@ -70,7 +71,7 @@ func (s *InstrumentedService) Protocols() []p2p.Protocol { } func (s *InstrumentedService) APIs() []rpc.API { - return nil + return s.apis } func (s *InstrumentedService) Start(server *p2p.Server) error { @@ -121,3 +122,14 @@ func InstrumentedServiceMakerB(base ServiceConstructor) ServiceConstructor { func InstrumentedServiceMakerC(base ServiceConstructor) ServiceConstructor { return InstrumentingWrapperMaker(base, reflect.TypeOf(InstrumentedServiceC{})) } + +// OneMethodApi is a single-method API handler to be returned by test services. +type OneMethodApi struct { + fun func() +} + +func (api *OneMethodApi) TheOneMethod() { + if api.fun != nil { + api.fun() + } +} -- cgit v1.2.3