aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/gethrpctest
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-11-18 00:33:25 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-11-27 17:06:12 +0800
commit1e806c4c775bd98b224eb0249007502d348e737b (patch)
treea34bfcac320df6f65e73eb1578b212289be86b5f /cmd/gethrpctest
parent8a44451edfa36ea40da564a2fa7ea905d45440a4 (diff)
downloadgo-tangerine-1e806c4c775bd98b224eb0249007502d348e737b.tar
go-tangerine-1e806c4c775bd98b224eb0249007502d348e737b.tar.gz
go-tangerine-1e806c4c775bd98b224eb0249007502d348e737b.tar.bz2
go-tangerine-1e806c4c775bd98b224eb0249007502d348e737b.tar.lz
go-tangerine-1e806c4c775bd98b224eb0249007502d348e737b.tar.xz
go-tangerine-1e806c4c775bd98b224eb0249007502d348e737b.tar.zst
go-tangerine-1e806c4c775bd98b224eb0249007502d348e737b.zip
cmd, common, core, eth, node, rpc, tests, whisper, xeth: use protocol stacks
Diffstat (limited to 'cmd/gethrpctest')
-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)