aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/gethrpctest/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/gethrpctest/main.go')
-rw-r--r--cmd/gethrpctest/main.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/cmd/gethrpctest/main.go b/cmd/gethrpctest/main.go
index 5419ccc46..cb4c7aece 100644
--- a/cmd/gethrpctest/main.go
+++ b/cmd/gethrpctest/main.go
@@ -45,11 +45,6 @@ var (
testKey = flag.String("key", defaultTestKey, "Private key of a test account to inject")
)
-var (
- ethereumServiceId = "ethereum"
- whisperServiceId = "whisper"
-)
-
func main() {
flag.Parse()
@@ -131,11 +126,11 @@ func MakeSystemNode(keydir string, privkey string, test *tests.BlockTest) (*node
TestGenesisBlock: test.Genesis,
AccountManager: accman,
}
- if err := stack.Register(ethereumServiceId, func(ctx *node.ServiceContext) (node.Service, error) { return eth.New(ctx, ethConf) }); err != nil {
+ if err := stack.Register("ethereum", func(ctx *node.ServiceContext) (node.Service, error) { return eth.New(ctx, ethConf) }); err != nil {
return nil, err
}
// Initialize and register the Whisper protocol
- if err := stack.Register(whisperServiceId, func(*node.ServiceContext) (node.Service, error) { return whisper.New(), nil }); err != nil {
+ if err := stack.Register("whisper", func(*node.ServiceContext) (node.Service, error) { return whisper.New(), nil }); err != nil {
return nil, err
}
return stack, nil
@@ -144,7 +139,9 @@ func MakeSystemNode(keydir string, privkey string, test *tests.BlockTest) (*node
// RunTest executes the specified test against an already pre-configured protocol
// stack to ensure basic checks pass before running RPC tests.
func RunTest(stack *node.Node, test *tests.BlockTest) error {
- blockchain := stack.Service(ethereumServiceId).(*eth.Ethereum).BlockChain()
+ var ethereum *eth.Ethereum
+ stack.SingletonService(&ethereum)
+ blockchain := ethereum.BlockChain()
// Process the blocks and verify the imported headers
blocks, err := test.TryBlocksInsert(blockchain)